@@ -35,6 +35,7 @@ import filter_simplefilter from '../data/styles/filter_simpleFilter';
35
35
import filter_nestedfilter from '../data/styles/filter_nestedFilter' ;
36
36
import filter_invalidfilter from '../data/styles/filter_invalidFilter' ;
37
37
import function_marksymbolizer from '../data/styles/function_markSymbolizer' ;
38
+ import function_nested_fillsymbolizer from '../data/styles/function_nested_fillSymbolizer' ;
38
39
import point_styledLabel_static from '../data/styles/point_styledLabel_static' ;
39
40
import multi_twoRulesSimplepoint from '../data/styles/multi_twoRulesSimplepoint' ;
40
41
import multi_simplefillSimpleline from '../data/styles/multi_simplefillSimpleline' ;
@@ -48,6 +49,8 @@ import point_styledlabel from '../data/styles/point_styledlabel';
48
49
import point_fontglyph from '../data/styles/point_fontglyph' ;
49
50
import unsupported_properties from '../data/styles/unsupported_properties' ;
50
51
52
+ import ol_function_marksymbolizer from '../data/olStyles/function_markSymbolizer' ;
53
+ import ol_function_nested_fillsymbolizer from '../data/olStyles/function_nested_fillSymbolizer' ;
51
54
import ol_point_simplepoint from '../data/olStyles/point_simplepoint' ;
52
55
import ol_point_icon from '../data/olStyles/point_icon' ;
53
56
import ol_point_simplesquare from '../data/olStyles/point_simplesquare' ;
@@ -82,8 +85,8 @@ import {
82
85
} from 'geostyler-style' ;
83
86
84
87
import OlStyleUtil from './Util/OlStyleUtil' ;
85
- import olSimpleCross from '../data/olStyles/point_simplecross ' ;
86
- import olFunctionMark from '../data/olStyles/function_markSymbolizer ' ;
88
+ import function_boolean from '../data/styles/function_boolean ' ;
89
+ import { olBoolean1 as ol_function_boolean_fillsymbolizer1 , olBoolean2 as ol_function_boolean_fillsymbolizer2 } from '../data/olStyles/function_boolean ' ;
87
90
88
91
// reverse calculation of resolution for scale (from ol-util MapUtil)
89
92
function getResolutionForScale ( scale , units ) {
@@ -1121,12 +1124,39 @@ describe('OlStyleParser implements StyleParser', () => {
1121
1124
expect ( geoStylerStyle ) . toBeDefined ( ) ;
1122
1125
expect ( typeof geoStylerStyle === 'function' ) . toBe ( true ) ;
1123
1126
geoStylerStyle = geoStylerStyle as OlParserStyleFct ;
1124
- const dummyFeat = new OlFeature ( {
1125
- path : 'image.jpg'
1126
- } ) ;
1127
+ const dummyFeat = new OlFeature ( ) ;
1127
1128
const targetStyle = geoStylerStyle ( dummyFeat ) ;
1128
1129
expect ( geoStylerStyle . __geoStylerStyle ) . toEqual ( function_marksymbolizer ) ;
1129
- expect ( targetStyle [ 0 ] ) . toEqual ( olFunctionMark ) ;
1130
+ expect ( targetStyle [ 0 ] ) . toEqual ( ol_function_marksymbolizer ) ;
1131
+ } ) ;
1132
+
1133
+ it ( 'can write a FillSymbolizer with a nested GeoStylerFunction' , async ( ) => {
1134
+ let { output : geoStylerStyle } = await styleParser . writeStyle ( function_nested_fillsymbolizer ) ;
1135
+ expect ( geoStylerStyle ) . toBeDefined ( ) ;
1136
+ expect ( typeof geoStylerStyle === 'function' ) . toBe ( true ) ;
1137
+ geoStylerStyle = geoStylerStyle as OlParserStyleFct ;
1138
+ const dummyFeat = new OlFeature ( ) ;
1139
+ const targetStyle = geoStylerStyle ( dummyFeat ) ;
1140
+ expect ( geoStylerStyle . __geoStylerStyle ) . toEqual ( function_nested_fillsymbolizer ) ;
1141
+ expect ( targetStyle [ 0 ] ) . toEqual ( ol_function_nested_fillsymbolizer ) ;
1142
+ } ) ;
1143
+
1144
+ it ( 'can write a Filter with a GeoStylerBooleanFunction' , async ( ) => {
1145
+ let { output : geoStylerStyle } = await styleParser . writeStyle ( function_boolean ) ;
1146
+ expect ( geoStylerStyle ) . toBeDefined ( ) ;
1147
+ expect ( typeof geoStylerStyle === 'function' ) . toBe ( true ) ;
1148
+ geoStylerStyle = geoStylerStyle as OlParserStyleFct ;
1149
+ const dummyFeat1 = new OlFeature ( {
1150
+ testprop : 0.8
1151
+ } ) ;
1152
+ const dummyFeat2 = new OlFeature ( {
1153
+ testprop : 2
1154
+ } ) ;
1155
+ const targetStyle1 = geoStylerStyle ( dummyFeat1 ) ;
1156
+ const targetStyle2 = geoStylerStyle ( dummyFeat2 ) ;
1157
+ expect ( geoStylerStyle . __geoStylerStyle ) . toEqual ( function_boolean ) ;
1158
+ expect ( targetStyle1 [ 0 ] ) . toEqual ( ol_function_boolean_fillsymbolizer1 ) ;
1159
+ expect ( targetStyle2 [ 0 ] ) . toEqual ( ol_function_boolean_fillsymbolizer2 ) ;
1130
1160
} ) ;
1131
1161
1132
1162
it ( 'adds unsupportedProperties to the write output' , async ( ) => {
0 commit comments