[core] Add a method for statically evaluating font stacks used by a style
This commit is contained in:
38
test/fixtures/style_parser/font_stacks.json
vendored
Normal file
38
test/fixtures/style_parser/font_stacks.json
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"version": 8,
|
||||
"sources": {
|
||||
"source": {
|
||||
"type": "vector",
|
||||
"tiles": []
|
||||
}
|
||||
},
|
||||
"layers": [{
|
||||
"id": "a",
|
||||
"type": "symbol",
|
||||
"source": "source",
|
||||
"source-layer": "source-layer",
|
||||
"layout": {
|
||||
"text-font": ["a"]
|
||||
}
|
||||
}, {
|
||||
"id": "a,b",
|
||||
"type": "symbol",
|
||||
"source": "source",
|
||||
"source-layer": "source-layer",
|
||||
"layout": {
|
||||
"text-font": {
|
||||
"stops": [[0, ["a", "b"]]]
|
||||
}
|
||||
}
|
||||
}, {
|
||||
"id": "a,b;a,b,c",
|
||||
"type": "symbol",
|
||||
"source": "source",
|
||||
"source-layer": "source-layer",
|
||||
"layout": {
|
||||
"text-font": {
|
||||
"stops": [[0, ["a", "b"]], [1, ["a", "b", "c"]]]
|
||||
}
|
||||
}
|
||||
}]
|
||||
}
|
||||
@@ -113,3 +113,13 @@ TEST(StyleParser, ParseTileJSONVector) {
|
||||
EXPECT_EQ("attribution", result->attribution);
|
||||
EXPECT_EQ("http://a.tiles.mapbox.com/mapbox.streets/{z}-{x}-{y}.vector.pbf?access_token=key", result->tiles[0]);
|
||||
}
|
||||
|
||||
TEST(StyleParser, FontStacks) {
|
||||
StyleParser parser;
|
||||
parser.parse(util::read_file("test/fixtures/style_parser/font_stacks.json"));
|
||||
auto result = parser.fontStacks();
|
||||
ASSERT_EQ(3, result.size());
|
||||
ASSERT_EQ("a", result[0]);
|
||||
ASSERT_EQ("a,b", result[1]);
|
||||
ASSERT_EQ("a,b,c", result[2]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user