Skip to content

Commit

Permalink
Add expression test for distance expression
Browse files Browse the repository at this point in the history
update ignore list
  • Loading branch information
zmiao committed Apr 29, 2020
1 parent ec726ef commit 7d4537c
Show file tree
Hide file tree
Showing 26 changed files with 4,555 additions and 1 deletion.
22 changes: 21 additions & 1 deletion test/ignores.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
{
"expression-tests/distance/invalid-geometry-input": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397",
"expression-tests/distance/line-to-line-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397",
"expression-tests/distance/line-to-lines-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397",
"expression-tests/distance/lines-to-lines-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397",
"expression-tests/distance/point-to-line-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397",
"expression-tests/distance/point-to-lines-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397",
"expression-tests/distance/point-to-point-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397",
"expression-tests/distance/point-to-points-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397",
"expression-tests/distance/points-to-line-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397",
"expression-tests/distance/points-to-lines-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397",
"expression-tests/distance/points-to-points-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397",
"expression-tests/distance/points-to-polygons-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16446",
"expression-tests/distance/lines-to-polygons-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16446",
"expression-tests/distance/polygon-to-polygons-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16446",
"expression-tests/distance/polygons-to-polygons-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16446",
"query-tests/regressions/mapbox-gl-js#4494": "https://github.com/mapbox/mapbox-gl-js/issues/2716",
"render-tests/geojson/inline-linestring-fill": "current behavior is arbitrary",
"render-tests/line-dasharray/case/square": "https://github.com/mapbox/mapbox-gl-js/issues/9531",
Expand All @@ -25,5 +40,10 @@
"render-tests/tile-mode/streets-v11": "skip - mapbox-gl-js does not support tile-mode",
"render-tests/within/paint-line": "https://github.com/mapbox/mapbox-gl-js/issues/7023",
"render-tests/icon-text-fit/text-variable-anchor-tile-map-mode": "skip - mapbox-gl-js does not support tile-mode",
"render-tests/text-variable-anchor/all-anchors-labels-priority-tile-map-mode": "skip - mapbox-gl-js does not support tile-mode"
"render-tests/text-variable-anchor/all-anchors-labels-priority-tile-map-mode": "skip - mapbox-gl-js does not support tile-mode",
"render-tests/distance/filter-with-distance-expression": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397",
"render-tests/distance/paint-circle": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397",
"render-tests/distance/paint-line": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397",
"render-tests/distance/symbol-style": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397",
"render-tests/distance/paint-polygon": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16446"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"expression": ["distance", {
"type": "Unknown",
"coordinates": [[[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]]
}],
"inputs": [[{
"zoom": 3,
"canonicalID": {
"z": 3,
"x": 3,
"y": 3
}
}, {
"geometry": {
"type": "Point",
"coordinates": [6, 6]
}
}], [{
"zoom": 3,
"canonicalID": {
"z": 3,
"x": 3,
"y": 3
}
}, {
"geometry": {
"type": "Point",
"coordinates": [2, 2]
}
}], [{
"zoom": 3,
"canonicalID": {
"z": 3,
"x": 3,
"y": 3
}
}, {
"geometry": {
"type": "LineString",
"coordinates": [[3, 3], [4, 1]]
}
}]],
"expected": {
"compiled": {
"errors": [{
"error": "Unknown not yet implemented",
"key": ""
}, {
"key": "",
"error": "'distance' expression needs to be an array with format [\"distance\", GeoJSONObj]."
}],
"result": "error"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"expression": ["distance", {
"type": "Feature",
"properties": {
"stroke": "#d7d47e",
"stroke-width": 2,
"stroke-opacity": -1,
"value": true
},
"geometry": {
"type": "LineString",
"coordinates": [[103.89315605163574, 1.3430843400832895], [103.89646053314209, 1.341239486566936], [103.89864921569824, 1.339909475029482], [103.90238285064697, 1.3386652700342137], [103.90551567077637, 1.338021715478541], [103.90847682952881, 1.337549775363733]]
}
}],
"inputs": [[{
"zoom": 13,
"canonicalID": {
"z": 13,
"x": 6460,
"y": 4065
}
}, {
"geometry": {
"type": "LineString",
"coordinates": [[103.88373613357544, 1.3323584281174479], [103.88704061508179, 1.3331092434795238], [103.88867139816284, 1.3334739251442105], [103.88972282409668, 1.3337957030387755], [103.89111757278441, 1.334331999436213], [103.89274835586547, 1.3351900734288747], [103.89476537704467, 1.3366702503621644]]
}
}], [{
"zoom": 13,
"canonicalID": {
"z": 13,
"x": 6460,
"y": 4065
}
}, {
"geometry": {
"type": "LineString",
"coordinates": [[103.90201807022095, 1.3571781167763333], [103.90379905700684, 1.3606103787570532], [103.90506505966187, 1.363012959238619], [103.9055585861206, 1.3638924747085997], [103.90648126602173, 1.365887472021871], [103.90686750411988, 1.3668527927080132]]
}
}], [{
"zoom": 13,
"canonicalID": {
"z": 13,
"x": 6460,
"y": 4065
}
}, {
"geometry": {
"type": "LineString",
"coordinates": [[103.95070552825928, 1.3499059956258364], [103.95280838012696, 1.3506782573132619], [103.95396709442139, 1.3515792289717337], [103.95486831665039, 1.3527376206128572], [103.95525455474852, 1.3542392385837099], [103.95538330078125, 1.35514020891972]]
}
}], [{
"zoom": 13,
"canonicalID": {
"z": 13,
"x": 6460,
"y": 4065
}
}, {
"geometry": {
"type": "LineString",
"coordinates": [[103.90637397766113, 1.3406817398811269], [103.90603065490723, 1.334331999436213]]
}
}]],
"expected": {
"outputs": [530.029, 1841.19, 4894.16, 0],
"serialized": ["distance", {
"properties": {
"stroke-opacity": -1,
"value": true,
"stroke-width": 2,
"stroke": "#d7d47e"
},
"geometry": {
"type": "LineString",
"coordinates": [[103.89315605163574, 1.3430843400832895], [103.89646053314209, 1.341239486566936], [103.89864921569824, 1.339909475029482], [103.90238285064697, 1.3386652700342137], [103.90551567077637, 1.338021715478541], [103.90847682952881, 1.337549775363733]]
},
"type": "Feature"
}],
"compiled": {
"type": "number",
"isFeatureConstant": false,
"isZoomConstant": true,
"result": "success"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"expression": ["distance", {
"type": "Feature",
"properties": {},
"geometry": {
"type": "LineString",
"coordinates": [[103.89315605163574, 1.3430843400832895], [103.89646053314209, 1.341239486566936], [103.89864921569824, 1.339909475029482], [103.90238285064697, 1.3386652700342137], [103.90551567077637, 1.338021715478541], [103.90847682952881, 1.337549775363733]]
}
}],
"inputs": [[{
"zoom": 13,
"canonicalID": {
"z": 13,
"x": 6460,
"y": 4065
}
}, {
"geometry": {
"type": "MultiLineString",
"coordinates": [[[103.88373613357544, 1.3323584281174479], [103.88704061508179, 1.3331092434795238], [103.88867139816284, 1.3334739251442105], [103.88972282409668, 1.3337957030387755], [103.89111757278441, 1.334331999436213], [103.89274835586547, 1.3351900734288747], [103.89476537704467, 1.3366702503621644]], [[103.90201807022095, 1.3571781167763333], [103.90379905700684, 1.3606103787570532], [103.90506505966187, 1.363012959238619], [103.9055585861206, 1.3638924747085997], [103.90648126602173, 1.365887472021871], [103.90686750411988, 1.3668527927080132]], [[103.95070552825928, 1.3499059956258364], [103.95280838012696, 1.3506782573132619], [103.95396709442139, 1.3515792289717337], [103.95486831665039, 1.3527376206128572], [103.95525455474852, 1.3542392385837099], [103.95538330078125, 1.35514020891972]]]
}
}]],
"expected": {
"outputs": [530.029],
"serialized": ["distance", {
"properties": {},
"geometry": {
"type": "LineString",
"coordinates": [[103.89315605163574, 1.3430843400832895], [103.89646053314209, 1.341239486566936], [103.89864921569824, 1.339909475029482], [103.90238285064697, 1.3386652700342137], [103.90551567077637, 1.338021715478541], [103.90847682952881, 1.337549775363733]]
},
"type": "Feature"
}],
"compiled": {
"type": "number",
"isFeatureConstant": false,
"isZoomConstant": true,
"result": "success"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"expression": ["distance", {
"type": "Feature",
"properties": {},
"geometry": {
"type": "MultiLineString",
"coordinates": [[[103.89341354370116, 1.3396949569719253], [103.8960313796997, 1.3380646191208426], [103.8982629776001, 1.3356620139971914]], [[103.901309967041, 1.3559982755948157], [103.89989376068115, 1.3525231036839903]], [[103.95074844360352, 1.349755833602559], [103.95249724388123, 1.3503886592092312]]]
}
}],
"inputs": [[{
"zoom": 13,
"canonicalID": {
"z": 13,
"x": 6460,
"y": 4065
}
}, {
"geometry": {
"type": "MultiLineString",
"coordinates": [[[103.88373613357544, 1.3323584281174479], [103.88704061508179, 1.3331092434795238], [103.88867139816284, 1.3334739251442105], [103.88972282409668, 1.3337957030387755], [103.89111757278441, 1.334331999436213], [103.89274835586547, 1.3351900734288747], [103.89476537704467, 1.3366702503621644]], [[103.90201807022095, 1.3571781167763333], [103.90379905700684, 1.3606103787570532], [103.90506505966187, 1.363012959238619], [103.9055585861206, 1.3638924747085997], [103.90648126602173, 1.365887472021871], [103.90686750411988, 1.3668527927080132]], [[103.95070552825928, 1.3499059956258364], [103.95280838012696, 1.3506782573132619], [103.95396709442139, 1.3515792289717337], [103.95486831665039, 1.3527376206128572], [103.95525455474852, 1.3542392385837099], [103.95538330078125, 1.35514020891972]]]
}
}]],
"expected": {
"outputs": [17.2408],
"serialized": ["distance", {
"properties": {},
"geometry": {
"type": "MultiLineString",
"coordinates": [[[103.89341354370116, 1.3396949569719253], [103.8960313796997, 1.3380646191208426], [103.8982629776001, 1.3356620139971914]], [[103.901309967041, 1.3559982755948157], [103.89989376068115, 1.3525231036839903]], [[103.95074844360352, 1.349755833602559], [103.95249724388123, 1.3503886592092312]]]
},
"type": "Feature"
}],
"compiled": {
"type": "number",
"isFeatureConstant": false,
"isZoomConstant": true,
"result": "success"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"expression": ["distance", {
"type": "Feature",
"properties": {},
"geometry": {
"type": "MultiPolygon",
"coordinates": [[[[103.88809204101563, 1.3621763466641713], [103.88465881347656, 1.3565131154538628], [103.8896369934082, 1.3535956881386369], [103.90422821044922, 1.3575427948432913], [103.90079498291016, 1.364064087445756], [103.88809204101563, 1.3621763466641713]]], [[[103.87899398803711, 1.3395233425123459], [103.87521743774414, 1.330256143886628], [103.8819122314453, 1.3275103005613949], [103.88998031616211, 1.3299129136379467], [103.89392852783203, 1.3369491241772669], [103.88757705688477, 1.341239486566936], [103.87899398803711, 1.3395233425123459]]], [[[103.91864776611328, 1.3503350299269142], [103.91469955444336, 1.3393517280407568], [103.92414093017578, 1.3324871393386304], [103.93529891967774, 1.335232977120653], [103.93667221069336, 1.3432988578436807], [103.93598556518555, 1.351021484651125], [103.91864776611328, 1.3503350299269142]]]]
}
}],
"inputs": [[{
"zoom": 13,
"canonicalID": {
"z": 13,
"x": 6460,
"y": 4065
}
}, {
"geometry": {
"type": "MultiLineString",
"coordinates": [[[103.88373613357544, 1.3323584281174479], [103.88704061508179, 1.3331092434795238], [103.88867139816284, 1.3334739251442105], [103.88972282409668, 1.3337957030387755], [103.89111757278441, 1.334331999436213], [103.89274835586547, 1.3351900734288747], [103.89476537704467, 1.3366702503621644]], [[103.90201807022095, 1.3571781167763333], [103.90379905700684, 1.3606103787570532], [103.90506505966187, 1.363012959238619], [103.9055585861206, 1.3638924747085997], [103.90648126602173, 1.365887472021871], [103.90686750411988, 1.3668527927080132]], [[103.95070552825928, 1.3499059956258364], [103.95280838012696, 1.3506782573132619], [103.95396709442139, 1.3515792289717337], [103.95486831665039, 1.3527376206128572], [103.95525455474852, 1.3542392385837099], [103.95538330078125, 1.35514020891972]]]
}
}], [{
"zoom": 13,
"canonicalID": {
"z": 13,
"x": 6460,
"y": 4065
}
}, {
"geometry": {
"type": "MultiLineString",
"coordinates": [[[103.91040802001953, 1.3602886044036287], [103.91023635864258, 1.351021484651125], [103.91504287719727, 1.348618892268445]], [[103.89379978179932, 1.3396949569719253], [103.89431476593018, 1.3355762066278836], [103.89268398284912, 1.3316719681575607]]]
}
}], [{
"zoom": 13,
"canonicalID": {
"z": 13,
"x": 6460,
"y": 4065
}
}, {
"geometry": {
"type": "LineString",
"coordinates": [[103.92019271850586, 1.3529092341423024], [103.91701698303223, 1.3336884437452606]]
}
}], [{
"zoom": 13,
"canonicalID": {
"z": 13,
"x": 6460,
"y": 4065
}
}, {
"geometry": {
"type": "LineString",
"coordinates": [[103.88586044311522, 1.3379788118355014], [103.88628959655762, 1.3329161766939824]]
}
}]],
"expected": {
"outputs": [0, 23.6932, 0, 0],
"serialized": ["distance", {
"properties": {},
"geometry": {
"type": "MultiPolygon",
"coordinates": [[[[103.88809204101563, 1.3621763466641713], [103.88465881347656, 1.3565131154538628], [103.8896369934082, 1.3535956881386369], [103.90422821044922, 1.3575427948432913], [103.90079498291016, 1.364064087445756], [103.88809204101563, 1.3621763466641713]]], [[[103.87899398803711, 1.3395233425123459], [103.87521743774414, 1.330256143886628], [103.8819122314453, 1.3275103005613949], [103.88998031616211, 1.3299129136379467], [103.89392852783203, 1.3369491241772669], [103.88757705688477, 1.341239486566936], [103.87899398803711, 1.3395233425123459]]], [[[103.91864776611328, 1.3503350299269142], [103.91469955444336, 1.3393517280407568], [103.92414093017578, 1.3324871393386304], [103.93529891967774, 1.335232977120653], [103.93667221069336, 1.3432988578436807], [103.93598556518555, 1.351021484651125], [103.91864776611328, 1.3503350299269142]]]]
},
"type": "Feature"
}],
"compiled": {
"type": "number",
"isFeatureConstant": false,
"isZoomConstant": true,
"result": "success"
}
}
}
Loading

0 comments on commit 7d4537c

Please sign in to comment.