Skip to content

Commit

Permalink
Add tests for 'is-supported-script'
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisLoer committed Mar 28, 2018
1 parent 7e1cf9b commit 67055cc
Show file tree
Hide file tree
Showing 5 changed files with 159 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"expression": ["is-supported-script", ["get", "x"]],
"description": "'is-supported-script' always returns true when run without global context providing an 'isSupportedScript' function (as in the expression tests). The 'is-supported-script' render tests provide the necessary global context and exercise the functionality.",
"inputs": [
[{}, {"properties": {"x": "שָׁלוֹם"}}],
[{}, {"properties": {"x": "देवनागरी"}}]
],
"expected": {
"compiled": {
"result": "success",
"isFeatureConstant": false,
"isZoomConstant": true,
"type": "boolean"
},
"outputs": [true, true],
"serialized": ["is-supported-script", ["get", "x"]]
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"version": 8,
"metadata": {
"test": {
"width": 128,
"height": 128
}
},
"sources": {
"geojson": {
"type": "geojson",
"data": {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"name": "देवनागरी"
},
"geometry": {
"type": "Point",
"coordinates": [
0,
-15
]
}
},
{
"type": "Feature",
"properties": {
"name": "سلام۳۹"
},
"geometry": {
"type": "Point",
"coordinates": [
0,
15
]
}
}
]
}
}
},
"glyphs": "local://glyphs/{fontstack}/{range}.pbf",
"layers": [
{
"id": "background",
"type": "background",
"paint": {
"background-color": "white"
}
},
{
"id": "symbol",
"type": "symbol",
"source": "geojson",
"filter": ["is-supported-script", ["get", "name"]],
"layout": {
"symbol-placement": "point",
"text-field": ["get", "name"],
"text-font": [
"Open Sans Semibold",
"Arial Unicode MS Bold"
]
}
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"version": 8,
"metadata": {
"test": {
"width": 128,
"height": 128
}
},
"sources": {
"geojson": {
"type": "geojson",
"data": {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"name": "देवनागरी"
},
"geometry": {
"type": "Point",
"coordinates": [
0,
-15
]
}
},
{
"type": "Feature",
"properties": {
"name": "سلام۳۹"
},
"geometry": {
"type": "Point",
"coordinates": [
0,
15
]
}
}
]
}
}
},
"glyphs": "local://glyphs/{fontstack}/{range}.pbf",
"layers": [
{
"id": "background",
"type": "background",
"paint": {
"background-color": "white"
}
},
{
"id": "symbol",
"type": "symbol",
"source": "geojson",
"layout": {
"symbol-placement": "point",
"text-field": ["case",
["is-supported-script", ["get", "name"]],
["get", "name"],
"Not renderable"
],
"text-font": [
"Open Sans Semibold",
"Arial Unicode MS Bold"
]
}
}
]
}

0 comments on commit 67055cc

Please sign in to comment.