-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add interpolate-{hcl,lab} expression operators
- Loading branch information
1 parent
3d879b2
commit 7d67106
Showing
6 changed files
with
136 additions
and
7 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
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
40 changes: 40 additions & 0 deletions
40
test/integration/expression-tests/interpolate-hcl/linear/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,40 @@ | ||
{ | ||
"expression": [ | ||
"interpolate-hcl", | ||
["linear"], | ||
["get", "x"], | ||
1, | ||
"red", | ||
11, | ||
["get", "color"] | ||
], | ||
"inputs": [ | ||
[{}, {"properties": {"x": 0, "color": "blue"}}], | ||
[{}, {"properties": {"x": 5, "color": "blue"}}], | ||
[{}, {"properties": {"x": 11, "color": "blue"}}], | ||
[{}, {"properties": {"x": 11, "color": "oops blue"}}] | ||
], | ||
"expected": { | ||
"compiled": { | ||
"result": "success", | ||
"isFeatureConstant": false, | ||
"isZoomConstant": true, | ||
"type": "color" | ||
}, | ||
"outputs": [ | ||
[1, 0, 0, 1], | ||
[0.870599, -0.0798922, 0.394264, 1], | ||
[0, 0, 1, 1], | ||
{"error": "Could not parse color from value 'oops blue'"} | ||
], | ||
"serialized": [ | ||
"interpolate-hcl", | ||
["linear"], | ||
["number", ["get", "x"]], | ||
1, | ||
["rgba", 255, 0, 0, 1], | ||
11, | ||
["to-color", ["get", "color"]] | ||
] | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
test/integration/expression-tests/interpolate-lab/linear/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,40 @@ | ||
{ | ||
"expression": [ | ||
"interpolate-lab", | ||
["linear"], | ||
["get", "x"], | ||
1, | ||
"red", | ||
11, | ||
["get", "color"] | ||
], | ||
"inputs": [ | ||
[{}, {"properties": {"x": 0, "color": "blue"}}], | ||
[{}, {"properties": {"x": 5, "color": "blue"}}], | ||
[{}, {"properties": {"x": 11, "color": "blue"}}], | ||
[{}, {"properties": {"x": 11, "color": "oops blue"}}] | ||
], | ||
"expected": { | ||
"compiled": { | ||
"result": "success", | ||
"isFeatureConstant": false, | ||
"isZoomConstant": true, | ||
"type": "color" | ||
}, | ||
"outputs": [ | ||
[1, 0, 0, 1], | ||
[0.599999, 7.22057e-8, 0.4, 1], | ||
[0, 0, 1, 1], | ||
{"error": "Could not parse color from value 'oops blue'"} | ||
], | ||
"serialized": [ | ||
"interpolate-lab", | ||
["linear"], | ||
["number", ["get", "x"]], | ||
1, | ||
["rgba", 255, 0, 0, 1], | ||
11, | ||
["to-color", ["get", "color"]] | ||
] | ||
} | ||
} |