-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding render tests for image fallback with feature constant expressions and addImage
operation
#11391
Merged
Merged
Adding render tests for image fallback with feature constant expressions and addImage
operation
#11391
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addLayer will trigger tile re-layout. Would it be possible to move layer definition to style definition? List of operations may be:
Test will verify that updated set of images is used for property evaluation in the feature-state code path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @alexshalamov!
I tried the test with the layer definition in the style definition as you describe (in place of the current
"layers": []
. This causes the test to pass in GL Native but fail in GL JS. I think this is from an issue unique to render tests in GL JS.I see two ways around this:
I think the latter in the simplest approach for now, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tested out the changes you suggest, and they still don't seem to use the intended updateVertexVectors function in Native.