Skip to content
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

Update tests for line within polygon #9310

Merged
merged 1 commit into from
Feb 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions test/ignores.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@
"render-tests/fill-pattern/update-feature-state": "https://github.com/mapbox/mapbox-gl-js/issues/7207",
"render-tests/text-size/zero": "https://github.com/mapbox/mapbox-gl-js/issues/9161",
"render-tests/text-variable-anchor/left-top-right-buttom-offset-tile-map-mode": "skip - mapbox-gl-js does not need to render tiles",
"render-tests/within/filter-with-inlined-geojson" : "skip - TODO: Within Expression needs to be implemented in mapbox-gl-js",
"render-tests/within/layout-text" : "skip - TODO: Within Expression needs to be implemented in mapbox-gl-js",
"render-tests/within/paint-circle" : "skip - TODO: Within Expression needs to be implemented in mapbox-gl-js",
"render-tests/within/paint-icon" : "skip - TODO: Within Expression needs to be implemented in mapbox-gl-js",
"render-tests/within/paint-text" : "skip - TODO: Within Expression needs to be implemented in mapbox-gl-js",
"expression-tests/within/basic" : "skip - TODO: Within Expression needs to be implemented in mapbox-gl-js",
"expression-tests/within/invalid-geojson" : "skip - TODO: Within Expression needs to be implemented in mapbox-gl-js"
}
"render-tests/within/filter-with-inlined-geojson": "skip - port https://github.com/mapbox/mapbox-gl-native/pull/16157",
"render-tests/within/paint-circle": "skip - port https://github.com/mapbox/mapbox-gl-native/pull/16157",
"render-tests/within/paint-icon": "skip - port https://github.com/mapbox/mapbox-gl-native/pull/16157",
"render-tests/within/paint-text": "skip - port https://github.com/mapbox/mapbox-gl-native/pull/16157",
"render-tests/within/layout-text": "skip - port https://github.com/mapbox/mapbox-gl-native/pull/16194",
"render-tests/within/paint-line": "skip - port https://github.com/mapbox/mapbox-gl-native/pull/16220",
"expression-tests/within/point-within-polygon": "skip - port https://github.com/mapbox/mapbox-gl-native/pull/16157",
"expression-tests/within/invalid-geojson": "skip - port https://github.com/mapbox/mapbox-gl-native/pull/16157",
"expression-tests/within/non-supported": "skip - port https://github.com/mapbox/mapbox-gl-native/pull/16157",
"expression-tests/within/line-within-polygon": "skip - port https://github.com/mapbox/mapbox-gl-native/pull/16220"
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"compiled": {
"errors": [{
"key": "",
"error": "'Within' expression requires valid geojson source that contains polygon geometry type."
"error": "'within' expression requires valid geojson source that contains polygon geometry type."
}],
"result": "error"
}
Expand Down
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 test/integration/expression-tests/within/non-supported/test.json
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"
}]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,6 @@
"type": "Point",
"coordinates": [2, 2]
}
}], [{
"zoom": 3,
"canonicalID": {
"z": 3,
"x": 3,
"y": 3
}
}, {
"geometry": {
"type": "LineString",
"coordinates": [[3, 3], [4, 1]]
}
}]],
"expected": {
"compiled": {
Expand All @@ -47,7 +35,7 @@
"isZoomConstant": true,
"result": "success"
},
"outputs": [false, true, false],
"outputs": [false, true],
"serialized": ["within", {
"coordinates": [[[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]],
"type": "Polygon"
Expand Down
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 test/integration/render-tests/within/paint-line/style.json
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
}
}
]
}