summaryrefslogtreecommitdiff
path: root/test/text
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-04-06 09:20:07 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-04-14 15:39:31 -0700
commita50d7a331bccd5ef35f08d8d0e24a0348510eb5a (patch)
treeac174cebebefa07a4f90263b57aaa47747bf1ef8 /test/text
parent09a22715769c629ad433b405908b60e1b9fa969b (diff)
downloadqtlocation-mapboxgl-a50d7a331bccd5ef35f08d8d0e24a0348510eb5a.tar.gz
[core] Replace GlyphRangeSet in onGlyphsAvailable with optionals in the map
GlyphRangeSet isn't keyed by FontStack, so using it to indicate that a particular range was loaded could have produced false positives.
Diffstat (limited to 'test/text')
-rw-r--r--test/text/glyph_atlas.test.cpp32
1 files changed, 14 insertions, 18 deletions
diff --git a/test/text/glyph_atlas.test.cpp b/test/text/glyph_atlas.test.cpp
index e57a7944a4..5aff1ee441 100644
--- a/test/text/glyph_atlas.test.cpp
+++ b/test/text/glyph_atlas.test.cpp
@@ -12,11 +12,11 @@ using namespace mbgl;
class StubGlyphRequestor : public GlyphRequestor {
public:
- void onGlyphsAvailable(GlyphPositionMap positions, GlyphRangeSet ranges) override {
- if (glyphsAvailable) glyphsAvailable(std::move(positions), std::move(ranges));
+ void onGlyphsAvailable(GlyphPositionMap positions) override {
+ if (glyphsAvailable) glyphsAvailable(std::move(positions));
}
- std::function<void (GlyphPositionMap, GlyphRangeSet)> glyphsAvailable;
+ std::function<void (GlyphPositionMap)> glyphsAvailable;
};
class GlyphAtlasTest {
@@ -63,15 +63,14 @@ TEST(GlyphAtlas, LoadingSuccess) {
ASSERT_EQ(range, GlyphRange(0, 255));
};
- test.requestor.glyphsAvailable = [&] (GlyphPositionMap positions, GlyphRangeSet ranges) {
+ test.requestor.glyphsAvailable = [&] (GlyphPositionMap positions) {
const auto& testPositions = positions.at({{"Test Stack"}});
- ASSERT_EQ(testPositions.size(), 2u);
+ ASSERT_EQ(testPositions.size(), 3u);
ASSERT_EQ(testPositions.count(u'a'), 1u);
ASSERT_EQ(testPositions.count(u'å'), 1u);
-
- ASSERT_EQ(ranges.size(), 1u);
- ASSERT_EQ((ranges.count({0, 255})), 1u);
+ ASSERT_EQ(testPositions.count(u' '), 1u);
+ ASSERT_TRUE(bool(testPositions.at(u' ')));
test.end();
};
@@ -79,7 +78,7 @@ TEST(GlyphAtlas, LoadingSuccess) {
test.run(
"test/fixtures/resources/glyphs.pbf",
GlyphDependencies {
- {{{"Test Stack"}}, {u'a', u'å'}}
+ {{{"Test Stack"}}, {u'a', u'å', u' '}}
});
}
@@ -104,7 +103,7 @@ TEST(GlyphAtlas, LoadingFail) {
test.end();
};
- test.requestor.glyphsAvailable = [&] (GlyphPositionMap, GlyphRangeSet) {
+ test.requestor.glyphsAvailable = [&] (GlyphPositionMap) {
FAIL();
test.end();
};
@@ -135,7 +134,7 @@ TEST(GlyphAtlas, LoadingCorrupted) {
test.end();
};
- test.requestor.glyphsAvailable = [&] (GlyphPositionMap, GlyphRangeSet) {
+ test.requestor.glyphsAvailable = [&] (GlyphPositionMap) {
FAIL();
test.end();
};
@@ -186,15 +185,12 @@ TEST(GlyphAtlas, LoadingInvalid) {
ASSERT_EQ(range, GlyphRange(0, 255));
};
- test.requestor.glyphsAvailable = [&] (GlyphPositionMap positions, GlyphRangeSet ranges) {
+ test.requestor.glyphsAvailable = [&] (GlyphPositionMap positions) {
const auto& testPositions = positions.at({{"Test Stack"}});
- ASSERT_EQ(testPositions.size(), 1u);
- ASSERT_EQ(testPositions.count(u'A'), 0u);
- ASSERT_EQ(testPositions.count(u'E'), 1u);
-
- ASSERT_EQ(ranges.size(), 1u);
- ASSERT_EQ((ranges.count({0, 255})), 1u);
+ ASSERT_EQ(testPositions.size(), 2u);
+ ASSERT_FALSE(bool(testPositions.at(u'A')));
+ ASSERT_TRUE(bool(testPositions.at(u'E')));
test.end();
};