-
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 data-driven format option tests.
"text-font" can't be data-driven because we need to be able to statically analyze set of required fonts.
- Loading branch information
Showing
2 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
test/integration/expression-tests/format/data-driven-font/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,48 @@ | ||
{ | ||
"expression": [ | ||
"format", | ||
"a", | ||
{ | ||
"font-scale": ["get", "font-scale"] | ||
} | ||
], | ||
"inputs": [ | ||
[{}, {"properties": {"font-scale": 1.5}}], | ||
[{}, {"properties": {"font-scale": 0.5}}] | ||
], | ||
"expected": { | ||
"compiled": { | ||
"result": "success", | ||
"isFeatureConstant": false, | ||
"isZoomConstant": true, | ||
"type": "formatted" | ||
}, | ||
"outputs": [ | ||
{ | ||
"sections": [ | ||
{ | ||
"text": "a", | ||
"scale": 1.5, | ||
"fontStack": null | ||
} | ||
] | ||
}, | ||
{ | ||
"sections": [ | ||
{ | ||
"text": "a", | ||
"scale": 0.5, | ||
"fontStack": null | ||
} | ||
] | ||
} | ||
], | ||
"serialized": [ | ||
"format", | ||
"a", | ||
{ | ||
"font-scale": ["number", ["get", "font-scale"]] | ||
} | ||
] | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
test/integration/expression-tests/format/data-driven-scale/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,23 @@ | ||
{ | ||
"expression": [ | ||
"format", | ||
"a", | ||
{ | ||
"text-font": ["array", ["string", ["get", "text-font"]]] | ||
} | ||
], | ||
"inputs": [ | ||
[{}, {"properties": {"text-font": "test"}}] | ||
], | ||
"expected": { | ||
"compiled": { | ||
"result": "error", | ||
"errors": [ | ||
{ | ||
"error": "Expected array<string> but found array instead.", | ||
"key": "[1]" | ||
} | ||
] | ||
} | ||
} | ||
} |