diff options
author | Thiago Marcos P. Santos <thiago@mapbox.com> | 2015-07-15 12:02:58 +0300 |
---|---|---|
committer | Thiago Marcos P. Santos <thiago@mapbox.com> | 2015-07-17 21:00:34 +0300 |
commit | 234a6539311bca387a982ad1c6f51dde77d3c450 (patch) | |
tree | 6fb2fee309fc98edb4c6a8f3d0549c91548a21c1 /test/style | |
parent | dbf3edad8ae7a7cbaf7c109daa3f7f8c78c04c87 (diff) | |
download | qtlocation-mapboxgl-234a6539311bca387a982ad1c6f51dde77d3c450.tar.gz |
Use the observer pattern for GlyphPBF loading
This will make the code a lot more clear and it will
also move how parsing is initiated to the GlyphPBF
class, to be initiated after the request, like we do
for other resources.
Diffstat (limited to 'test/style')
-rw-r--r-- | test/style/glyph_store.cpp | 10 | ||||
-rw-r--r-- | test/style/resource_loading.cpp | 2 |
2 files changed, 9 insertions, 3 deletions
diff --git a/test/style/glyph_store.cpp b/test/style/glyph_store.cpp index fb4355b98b..fe614e8c60 100644 --- a/test/style/glyph_store.cpp +++ b/test/style/glyph_store.cpp @@ -138,7 +138,8 @@ TEST_F(GlyphStoreTest, LoadingFail) { ASSERT_TRUE(error != nullptr); auto fontStack = store->getFontStack(params.stack); - ASSERT_EQ(*fontStack, nullptr); + ASSERT_TRUE(fontStack->getMetrics().empty()); + ASSERT_TRUE(fontStack->getSDFs().empty()); for (const auto& range : params.ranges) { ASSERT_FALSE(store->hasGlyphRanges(params.stack, {range})); @@ -171,6 +172,10 @@ TEST_F(GlyphStoreTest, LoadingCorrupted) { ASSERT_TRUE(error != nullptr); + auto fontStack = store->getFontStack(params.stack); + ASSERT_TRUE(fontStack->getMetrics().empty()); + ASSERT_TRUE(fontStack->getSDFs().empty()); + for (const auto& range : params.ranges) { ASSERT_FALSE(store->hasGlyphRanges(params.stack, {range})); } @@ -215,7 +220,8 @@ TEST_F(GlyphStoreTest, InvalidURL) { ASSERT_TRUE(error != nullptr); auto fontStack = store->getFontStack(params.stack); - ASSERT_EQ(*fontStack, nullptr); + ASSERT_TRUE(fontStack->getMetrics().empty()); + ASSERT_TRUE(fontStack->getSDFs().empty()); stopTest(); }; diff --git a/test/style/resource_loading.cpp b/test/style/resource_loading.cpp index 025b9b0271..b4fdbc7c5a 100644 --- a/test/style/resource_loading.cpp +++ b/test/style/resource_loading.cpp @@ -164,4 +164,4 @@ INSTANTIATE_TEST_CASE_P(Style, ResourceLoading, std::make_pair("sprite.png", "Could not parse sprite image"), std::make_pair("raster.png", "Failed to parse \\[17\\/6553(4|5|6|7)\\/6553(4|5|6|7)\\]\\: error parsing raster image"), std::make_pair("vector.pbf", "Failed to parse \\[1(5|6)\\/1638(3|4)\\/1638(3|4)\\]\\: pbf unknown field type exception"), - std::make_pair("glyphs.pbf", "Failed to parse \\[test\\/fixtures\\/resources\\/glyphs.pbf\\]"))); + std::make_pair("glyphs.pbf", "Failed to parse \\[test\\/fixtures\\/resources\\/glyphs.pbf\\]: pbf unknown field type exception"))); |