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.
Add render tests for line within polygon. Update expression tests for…
… within expression (mapbox#9310)
- Loading branch information
1 parent
5453f7e
commit 9d99a2b
Showing
7 changed files
with
288 additions
and
22 deletions.
There are no files selected for viewing
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
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
44 changes: 44 additions & 0 deletions
44
test/integration/expression-tests/within/line-within-polygon/test.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,44 @@ | ||
{ | ||
"expression": ["within", { | ||
"type": "Polygon", | ||
"coordinates": [[[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]] | ||
}], | ||
"inputs": [[{ | ||
"zoom": 3, | ||
"canonicalID": { | ||
"z": 3, | ||
"x": 3, | ||
"y": 3 | ||
} | ||
}, { | ||
"geometry": { | ||
"type": "LineString", | ||
"coordinates": [[3, 3], [4, 1]] | ||
} | ||
}], [{ | ||
"zoom": 3, | ||
"canonicalID": { | ||
"z": 3, | ||
"x": 3, | ||
"y": 3 | ||
} | ||
}, { | ||
"geometry": { | ||
"type": "LineString", | ||
"coordinates": [[3, 3], [6, 6]] | ||
} | ||
}]], | ||
"expected": { | ||
"compiled": { | ||
"type": "boolean", | ||
"isFeatureConstant": false, | ||
"isZoomConstant": true, | ||
"result": "success" | ||
}, | ||
"outputs": [true, false], | ||
"serialized": ["within", { | ||
"coordinates": [[[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]], | ||
"type": "Polygon" | ||
}] | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
test/integration/expression-tests/within/non-supported/test.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,32 @@ | ||
{ | ||
"expression": ["within", { | ||
"type": "Polygon", | ||
"coordinates": [[[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]] | ||
}], | ||
"inputs": [[{ | ||
"zoom": 3, | ||
"canonicalID": { | ||
"z": 3, | ||
"x": 3, | ||
"y": 3 | ||
} | ||
}, { | ||
"geometry": { | ||
"type": "Polygon", | ||
"coordinates": [[[3, 3], [6, 6], [3, 3]]] | ||
} | ||
}]], | ||
"expected": { | ||
"compiled": { | ||
"type": "boolean", | ||
"isFeatureConstant": false, | ||
"isZoomConstant": true, | ||
"result": "success" | ||
}, | ||
"outputs": [false], | ||
"serialized": ["within", { | ||
"coordinates": [[[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]], | ||
"type": "Polygon" | ||
}] | ||
} | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
199 changes: 199 additions & 0 deletions
199
test/integration/render-tests/within/paint-line/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,199 @@ | ||
{ | ||
"version": 8, | ||
"metadata": { | ||
"test": { | ||
"width": 125, | ||
"height": 125 | ||
} | ||
}, | ||
"zoom": 2, | ||
"center": [ | ||
-24, | ||
-32 | ||
], | ||
"sources": { | ||
"line": { | ||
"type": "geojson", | ||
"data": { | ||
"type": "FeatureCollection", | ||
"features": [ | ||
{ | ||
"type": "Feature", | ||
"properties": {}, | ||
"geometry": { | ||
"type": "LineString", | ||
"coordinates": [ | ||
[ | ||
-30.805664062500004, | ||
-31.84023266790935 | ||
], | ||
[ | ||
-20.56640625, | ||
-32.026706293336126 | ||
] | ||
] | ||
} | ||
}, | ||
{ | ||
"type": "Feature", | ||
"properties": {}, | ||
"geometry": { | ||
"type": "LineString", | ||
"coordinates": [ | ||
[ | ||
-30.629882812499996, | ||
-28.420391085674304 | ||
], | ||
[ | ||
-18.544921875, | ||
-28.92163128242129 | ||
], | ||
[ | ||
-18.369140624999996, | ||
-36.49197347059368 | ||
], | ||
[ | ||
-27.24609375, | ||
-36.77409249464194 | ||
] | ||
] | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
"polygon": { | ||
"type": "geojson", | ||
"data": { | ||
"type": "FeatureCollection", | ||
"features": [ | ||
{ | ||
"type": "Feature", | ||
"properties": {}, | ||
"geometry": { | ||
"type": "Polygon", | ||
"coordinates": [ | ||
[ | ||
[ | ||
-31.9921875, | ||
-27.137368359795584 | ||
], | ||
[ | ||
-32.255859375, | ||
-35.49645605658415 | ||
], | ||
[ | ||
-22.9833984375, | ||
-35.7465122599185 | ||
], | ||
[ | ||
-22.5, | ||
-30.67571540416773 | ||
], | ||
[ | ||
-29.003906249999996, | ||
-30.29701788337204 | ||
], | ||
[ | ||
-28.9599609375, | ||
-37.64903402157864 | ||
], | ||
[ | ||
-16.1279296875, | ||
-37.89219554724435 | ||
], | ||
[ | ||
-16.5673828125, | ||
-26.82407078047018 | ||
], | ||
[ | ||
-31.9921875, | ||
-27.137368359795584 | ||
] | ||
] | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"layers": [ | ||
{ | ||
"id": "border", | ||
"type": "fill", | ||
"source": "polygon", | ||
"paint": { | ||
"fill-color": "black", | ||
"fill-opacity": 0.5 | ||
} | ||
}, | ||
{ | ||
"id": "draw", | ||
"type": "line", | ||
"source": "line", | ||
"paint": { | ||
"line-color": [ | ||
"case", | ||
[ | ||
"within", | ||
{ | ||
"type": "Polygon", | ||
"coordinates": [ | ||
[ | ||
[ | ||
-31.9921875, | ||
-27.137368359795584 | ||
], | ||
[ | ||
-32.255859375, | ||
-35.49645605658415 | ||
], | ||
[ | ||
-22.9833984375, | ||
-35.7465122599185 | ||
], | ||
[ | ||
-22.5, | ||
-30.67571540416773 | ||
], | ||
[ | ||
-29.003906249999996, | ||
-30.29701788337204 | ||
], | ||
[ | ||
-28.9599609375, | ||
-37.64903402157864 | ||
], | ||
[ | ||
-16.1279296875, | ||
-37.89219554724435 | ||
], | ||
[ | ||
-16.5673828125, | ||
-26.82407078047018 | ||
], | ||
[ | ||
-31.9921875, | ||
-27.137368359795584 | ||
] | ||
] | ||
] | ||
} | ||
], | ||
"red", | ||
"blue" | ||
] | ||
} | ||
}, | ||
{ | ||
"id": "circle", | ||
"type": "circle", | ||
"source": "line", | ||
"paint": { | ||
"circle-color": "yellow", | ||
"circle-radius": 2 | ||
} | ||
} | ||
] | ||
} |