diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-02-23 12:42:48 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-02-27 16:19:35 -0800 |
commit | e3500c1f791be82d64b50c7fa80b29b4e3c8a031 (patch) | |
tree | cba8edaf48b5de2aaf80443a397beaa6ceccc1a7 /test | |
parent | 47dcfe7d441933c8d75c5efca14fb4683cf7099e (diff) | |
download | qtlocation-mapboxgl-e3500c1f791be82d64b50c7fa80b29b4e3c8a031.tar.gz |
[core] Replace three maps/mutexes in GlyphAtlas with a single map and mutex
Diffstat (limited to 'test')
-rw-r--r-- | test/text/glyph_atlas.test.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/test/text/glyph_atlas.test.cpp b/test/text/glyph_atlas.test.cpp index 1ad2af9d82..3679cabc1b 100644 --- a/test/text/glyph_atlas.test.cpp +++ b/test/text/glyph_atlas.test.cpp @@ -83,8 +83,7 @@ TEST(GlyphAtlas, LoadingFail) { EXPECT_TRUE(error != nullptr); EXPECT_EQ(util::toString(error), "Failed by the test case"); - auto glyphSet = test.glyphAtlas.getGlyphSet({{"Test Stack"}}); - ASSERT_TRUE(glyphSet->getSDFs().empty()); + ASSERT_TRUE(test.glyphAtlas.getGlyphSet({{"Test Stack"}})->getSDFs().empty()); ASSERT_FALSE(test.glyphAtlas.hasGlyphRanges({{"Test Stack"}}, {{0, 255}})); test.end(); @@ -112,8 +111,7 @@ TEST(GlyphAtlas, LoadingCorrupted) { EXPECT_TRUE(error != nullptr); EXPECT_EQ(util::toString(error), "unknown pbf field type exception"); - auto glyphSet = test.glyphAtlas.getGlyphSet({{"Test Stack"}}); - ASSERT_TRUE(glyphSet->getSDFs().empty()); + ASSERT_TRUE(test.glyphAtlas.getGlyphSet({{"Test Stack"}})->getSDFs().empty()); ASSERT_FALSE(test.glyphAtlas.hasGlyphRanges({{"Test Stack"}}, {{0, 255}})); test.end(); @@ -144,21 +142,21 @@ TEST(GlyphAtlas, LoadingCancel) { } TEST(GlyphAtlas, InvalidSDFGlyph) { - GlyphSet glyphSet; - glyphSet.insert(66, SDFGlyph{ 66 /* ASCII 'B' */, + const FontStack fontStack{ "Mock Font" }; + + GlyphAtlasTest test; + GlyphPositions positions; + + auto glyphSet = test.glyphAtlas.getGlyphSet(fontStack); + glyphSet->insert(66, SDFGlyph{ 66 /* ASCII 'B' */, AlphaImage({7, 7}), /* correct */ { 1 /* width */, 1 /* height */, 0 /* left */, 0 /* top */, 0 /* advance */ } }); - glyphSet.insert(67, SDFGlyph{ 67 /* ASCII 'C' */, + glyphSet->insert(67, SDFGlyph{ 67 /* ASCII 'C' */, AlphaImage({518, 8}), /* correct */ { 512 /* width */, 2 /* height */, 0 /* left */, 0 /* top */, 0 /* advance */ } }); - - const FontStack fontStack{ "Mock Font" }; - - GlyphAtlasTest test; - GlyphPositions positions; test.glyphAtlas.addGlyphs(1, std::u16string{u"ABC"}, fontStack, glyphSet, positions); ASSERT_EQ(2u, positions.size()); |