@@ -2203,6 +2203,88 @@ def testLabelRotation(self):
2203
2203
'"direction"' ,
2204
2204
)
2205
2205
2206
+ def test_parse_visibility (self ):
2207
+ context = QgsMapBoxGlStyleConversionContext ()
2208
+ style = {
2209
+ "sources" : {"Basemaps" : {"type" : "vector" , "url" : "https://xxxxxx" }},
2210
+ "layers" : [
2211
+ {
2212
+ "id" : "at-layout-level-true" ,
2213
+ "source" : "streets" ,
2214
+ "source-layer" : "water" ,
2215
+ "type" : "fill" ,
2216
+ "paint" : {"fill-color" : "#00ffff" },
2217
+ "layout" : {
2218
+ "visibility" : "visible" ,
2219
+ "text-field" : "{substance}" ,
2220
+ },
2221
+ },
2222
+ {
2223
+ "id" : "at-layout-level-other" ,
2224
+ "source" : "streets" ,
2225
+ "source-layer" : "water" ,
2226
+ "type" : "fill" ,
2227
+ "paint" : {"fill-color" : "#00ffff" },
2228
+ "layout" : {
2229
+ "visibility" : "anOtherText" ,
2230
+ "text-field" : "{substance}" ,
2231
+ },
2232
+ },
2233
+ {
2234
+ "id" : "at-layout-level-false" ,
2235
+ "source" : "streets" ,
2236
+ "source-layer" : "water" ,
2237
+ "type" : "fill" ,
2238
+ "paint" : {"fill-color" : "#00ffff" },
2239
+ "layout" : {
2240
+ "visibility" : "none" ,
2241
+ "text-field" : "{substance}" ,
2242
+ },
2243
+ },
2244
+ {
2245
+ "id" : "at-root-level-true" ,
2246
+ "source" : "streets" ,
2247
+ "source-layer" : "water" ,
2248
+ "type" : "fill" ,
2249
+ "paint" : {"fill-color" : "#00ffff" },
2250
+ "visibility" : "visible" ,
2251
+ },
2252
+ {
2253
+ "id" : "at-root-level-other" ,
2254
+ "source" : "streets" ,
2255
+ "source-layer" : "water" ,
2256
+ "type" : "fill" ,
2257
+ "paint" : {"fill-color" : "#00ffff" },
2258
+ "visibility" : "anOtherText" ,
2259
+ },
2260
+ {
2261
+ "id" : "at-root-level-false" ,
2262
+ "source" : "streets" ,
2263
+ "source-layer" : "water" ,
2264
+ "type" : "fill" ,
2265
+ "paint" : {"fill-color" : "#00ffff" },
2266
+ "visibility" : "none" ,
2267
+ },
2268
+ ],
2269
+ }
2270
+
2271
+ converter = QgsMapBoxGlStyleConverter ()
2272
+ converter .convert (style , context )
2273
+
2274
+ renderer = converter .renderer ()
2275
+ style = renderer .style (0 )
2276
+ self .assertEqual (style .isEnabled (), True )
2277
+ style = renderer .style (1 )
2278
+ self .assertEqual (style .isEnabled (), True )
2279
+ style = renderer .style (2 )
2280
+ self .assertEqual (style .isEnabled (), False )
2281
+ style = renderer .style (3 )
2282
+ self .assertEqual (style .isEnabled (), True )
2283
+ style = renderer .style (4 )
2284
+ self .assertEqual (style .isEnabled (), True )
2285
+ style = renderer .style (5 )
2286
+ self .assertEqual (style .isEnabled (), False )
2287
+
2206
2288
def test_parse_zoom_levels (self ):
2207
2289
context = QgsMapBoxGlStyleConversionContext ()
2208
2290
style = {
0 commit comments