forked from mapbox/mapbox-gl-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding render tests for image fallback with feature constant expressi…
…ons and `addImage` operation (mapbox#11391) * Added tests for image fallback with constant expressions * Adding tests for 'addImage' operation and rearranging feature-state tests
- Loading branch information
1 parent
4308b16
commit 17b9bfb
Showing
12 changed files
with
369 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+2.41 KB
test/integration/render-tests/image-fallback-nested/add-image/expected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
76 changes: 76 additions & 0 deletions
76
test/integration/render-tests/image-fallback-nested/add-image/style.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
{ | ||
"version": 8, | ||
"metadata": { | ||
"test": { | ||
"height": 64, | ||
"width": 128, | ||
"operations": [ | ||
["addImage", "rocket", "./image/rocket.png"], | ||
["wait"], | ||
[ | ||
"addLayer", | ||
{ | ||
"id": "text", | ||
"type": "symbol", | ||
"source": "geojson", | ||
"layout": { | ||
"text-allow-overlap": true, | ||
"icon-allow-overlap": true, | ||
"icon-image": [ | ||
"coalesce", | ||
["image", "rocket"], | ||
["image", "fav-bicycle-18"] | ||
], | ||
"text-field": [ | ||
"case", | ||
["to-boolean", ["coalesce", ["image", "rocket"], ""]], | ||
"beta sprite", | ||
"fallback sprite" | ||
], | ||
"text-font": ["Open Sans Semibold", "Arial Unicode MS Bold"], | ||
"text-offset": [0, 0.6], | ||
"text-anchor": "top" | ||
}, | ||
"paint": { | ||
"text-color": [ | ||
"case", | ||
["to-boolean", ["coalesce", ["image", "rocket"], ""]], | ||
"blue", | ||
"red" | ||
], | ||
"text-opacity": [ | ||
"case", | ||
["to-boolean", ["coalesce", ["image", "rocket"], ""]], | ||
0.2, | ||
1 | ||
] | ||
} | ||
} | ||
], | ||
["wait"] | ||
] | ||
} | ||
}, | ||
"center": [0, 0], | ||
"zoom": 0, | ||
"sprite": "local://sprites/sprite", | ||
"sources": { | ||
"geojson": { | ||
"type": "geojson", | ||
"data": { | ||
"type": "FeatureCollection", | ||
"features": [ | ||
{ | ||
"type": "Feature", | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [0, 0] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"glyphs": "local://glyphs/{fontstack}/{range}.pbf", | ||
"layers": [] | ||
} |
Binary file added
BIN
+2.53 KB
.../integration/render-tests/image-fallback-nested/constant/available/expected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
78 changes: 78 additions & 0 deletions
78
test/integration/render-tests/image-fallback-nested/constant/available/style.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
{ | ||
"version": 8, | ||
"metadata": { | ||
"test": { | ||
"height": 64, | ||
"width": 128 | ||
} | ||
}, | ||
"center": [ 0, 0 ], | ||
"zoom": 0, | ||
"sprite": "local://sprites/sprite", | ||
"sources": { | ||
"geojson": { | ||
"type": "geojson", | ||
"data": { | ||
"type": "FeatureCollection", | ||
"features": [ | ||
{ | ||
"type": "Feature", | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [0, 0] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"glyphs": "local://glyphs/{fontstack}/{range}.pbf", | ||
"layers": [ | ||
{ | ||
"id": "text", | ||
"type": "symbol", | ||
"source": "geojson", | ||
"layout": { | ||
"text-allow-overlap": true, | ||
"icon-allow-overlap": true, | ||
"icon-image": [ | ||
"coalesce", | ||
["image", "fav-bicycle-18"], | ||
["image", "generic_metro"] | ||
], | ||
"text-field": [ "case", | ||
["to-boolean", ["coalesce", | ||
["image", "fav-bicycle-18"], | ||
"" | ||
]], | ||
"beta sprite", | ||
"fallback sprite" | ||
], | ||
"text-font": [ | ||
"Open Sans Semibold", | ||
"Arial Unicode MS Bold" | ||
], | ||
"text-offset": [0, 0.6], | ||
"text-anchor": "top" | ||
}, | ||
"paint": { | ||
"text-color": [ "case", | ||
["to-boolean", ["coalesce", | ||
["image", "fav-bicycle-18"], | ||
"" | ||
]], | ||
"blue", | ||
"red" | ||
], | ||
"text-opacity": [ "case", | ||
["to-boolean", ["coalesce", | ||
["image", "fav-bicycle-18"], | ||
"" | ||
]], | ||
0.2, | ||
1 | ||
] | ||
} | ||
} | ||
] | ||
} |
Binary file added
BIN
+2.83 KB
test/integration/render-tests/image-fallback-nested/constant/missing/expected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
78 changes: 78 additions & 0 deletions
78
test/integration/render-tests/image-fallback-nested/constant/missing/style.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
{ | ||
"version": 8, | ||
"metadata": { | ||
"test": { | ||
"height": 64, | ||
"width": 128 | ||
} | ||
}, | ||
"center": [ 0, 0 ], | ||
"zoom": 0, | ||
"sprite": "local://sprites/emerald", | ||
"sources": { | ||
"geojson": { | ||
"type": "geojson", | ||
"data": { | ||
"type": "FeatureCollection", | ||
"features": [ | ||
{ | ||
"type": "Feature", | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [0, 0] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"glyphs": "local://glyphs/{fontstack}/{range}.pbf", | ||
"layers": [ | ||
{ | ||
"id": "text", | ||
"type": "symbol", | ||
"source": "geojson", | ||
"layout": { | ||
"text-allow-overlap": true, | ||
"icon-allow-overlap": true, | ||
"icon-image": [ | ||
"coalesce", | ||
["image", "fav-bicycle-18"], | ||
["image", "generic_metro"] | ||
], | ||
"text-field": [ "case", | ||
["to-boolean", ["coalesce", | ||
["image", "fav-bicycle-18"], | ||
"" | ||
]], | ||
"beta sprite", | ||
"fallback sprite" | ||
], | ||
"text-font": [ | ||
"Open Sans Semibold", | ||
"Arial Unicode MS Bold" | ||
], | ||
"text-offset": [0, 0.6], | ||
"text-anchor": "top" | ||
}, | ||
"paint": { | ||
"text-color": [ "case", | ||
["to-boolean", ["coalesce", | ||
["image", "fav-bicycle-18"], | ||
"" | ||
]], | ||
"blue", | ||
"red" | ||
], | ||
"text-opacity": [ "case", | ||
["to-boolean", ["coalesce", | ||
["image", "fav-bicycle-18"], | ||
"" | ||
]], | ||
0.2, | ||
1 | ||
] | ||
} | ||
} | ||
] | ||
} |
File renamed without changes
137 changes: 137 additions & 0 deletions
137
...tegration/render-tests/image-fallback-nested/feature-state/add-image/style.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
{ | ||
"version": 8, | ||
"metadata": { | ||
"test": { | ||
"width": 64, | ||
"height": 64, | ||
"allowed": 0.0015, | ||
"operations": [ | ||
[ | ||
"addImage", | ||
"rocket", | ||
"./image/rocket.png" | ||
], | ||
[ | ||
"wait" | ||
], | ||
[ | ||
"addLayer", | ||
{ | ||
"id": "circle", | ||
"type": "circle", | ||
"source": "geojson", | ||
"paint": { | ||
"circle-radius": 5, | ||
"circle-color": [ "case", | ||
["to-boolean", ["coalesce", | ||
["image", ["get", "icon"]], | ||
"" | ||
] | ||
], | ||
[ "case", | ||
["boolean", [ "feature-state", "hover"], false ], | ||
"green", | ||
"blue" | ||
], | ||
[ "case", | ||
["boolean", [ "feature-state", "hover"], false ], | ||
"yellow", | ||
"red" | ||
] | ||
] | ||
} | ||
} | ||
], | ||
[ | ||
"setFeatureState", | ||
{ | ||
"source": "geojson", | ||
"id": "0" | ||
}, | ||
{ | ||
"hover": true | ||
} | ||
], | ||
[ | ||
"wait" | ||
], | ||
[ | ||
"setFeatureState", | ||
{ | ||
"source": "geojson", | ||
"id": "2" | ||
}, | ||
{ | ||
"hover": true | ||
} | ||
], | ||
[ | ||
"wait" | ||
] | ||
] | ||
} | ||
}, | ||
"zoom": 2, | ||
"sprite": "local://sprites/sprite", | ||
"sources": { | ||
"geojson": { | ||
"type": "geojson", | ||
"data": | ||
{ | ||
"type": "FeatureCollection", | ||
"features": [ | ||
{ | ||
"type": "Feature", | ||
"id": 0, | ||
"properties": { "icon": "rocket"}, | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [ | ||
-2, | ||
2 | ||
] | ||
} | ||
}, | ||
{ | ||
"type": "Feature", | ||
"id": 1, | ||
"properties": { "icon": "rocket"}, | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [ | ||
2, | ||
2 | ||
] | ||
} | ||
}, | ||
{ | ||
"type": "Feature", | ||
"id": 2, | ||
"properties": { "icon": "missing-icon"}, | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [ | ||
2, | ||
-2 | ||
] | ||
} | ||
}, | ||
{ | ||
"type": "Feature", | ||
"id": 3, | ||
"properties": { "icon": "missing-icon"}, | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [ | ||
-2, | ||
-2 | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"layers": [ | ||
] | ||
} |
File renamed without changes
File renamed without changes.
Binary file added
BIN
+472 Bytes
...tegration/render-tests/image-fallback-nested/feature-state/outside/expected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.