summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-09-15 17:03:13 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-09-19 09:40:43 -0700
commitdc1861f6d5391707126a20dbb0272f5bd3522de8 (patch)
tree961a3612706b9466d9ff0ef278ae1206b821aa88 /test
parent940124ff713a960d7f70071779dd37d07010fa80 (diff)
downloadqtlocation-mapboxgl-dc1861f6d5391707126a20dbb0272f5bd3522de8.tar.gz
[core] Merge GlyphStore and GlyphAtlas
Diffstat (limited to 'test')
-rw-r--r--test/text/glyph_atlas.cpp (renamed from test/style/glyph_store.cpp)40
1 files changed, 20 insertions, 20 deletions
diff --git a/test/style/glyph_store.cpp b/test/text/glyph_atlas.cpp
index 08ec6902b9..27d43a1721 100644
--- a/test/style/glyph_store.cpp
+++ b/test/text/glyph_atlas.cpp
@@ -3,7 +3,7 @@
#include <mbgl/test/stub_style_observer.hpp>
#include <mbgl/text/glyph_set.hpp>
-#include <mbgl/text/glyph_store.hpp>
+#include <mbgl/text/glyph_atlas.hpp>
#include <mbgl/util/run_loop.hpp>
#include <mbgl/util/string.hpp>
#include <mbgl/util/io.hpp>
@@ -11,20 +11,20 @@
using namespace mbgl;
-class GlyphStoreTest {
+class GlyphAtlasTest {
public:
util::RunLoop loop;
StubFileSource fileSource;
StubStyleObserver observer;
- GlyphStore glyphStore { fileSource };
+ GlyphAtlas glyphAtlas { 32, 32, fileSource };
void run(const std::string& url, const FontStack& fontStack, const std::set<GlyphRange>& glyphRanges) {
// Squelch logging.
Log::setObserver(std::make_unique<Log::NullObserver>());
- glyphStore.setObserver(&observer);
- glyphStore.setURL(url);
- glyphStore.hasGlyphRanges(fontStack, glyphRanges);
+ glyphAtlas.setObserver(&observer);
+ glyphAtlas.setURL(url);
+ glyphAtlas.hasGlyphRanges(fontStack, glyphRanges);
loop.run();
}
@@ -34,8 +34,8 @@ public:
}
};
-TEST(GlyphStore, LoadingSuccess) {
- GlyphStoreTest test;
+TEST(GlyphAtlas, LoadingSuccess) {
+ GlyphAtlasTest test;
test.fileSource.glyphsResponse = [&] (const Resource& resource) {
EXPECT_EQ(Resource::Kind::Glyphs, resource.kind);
@@ -50,10 +50,10 @@ TEST(GlyphStore, LoadingSuccess) {
};
test.observer.glyphsLoaded = [&] (const FontStack&, const GlyphRange&) {
- if (!test.glyphStore.hasGlyphRanges({{"Test Stack"}}, {{0, 255}, {256, 511}}))
+ if (!test.glyphAtlas.hasGlyphRanges({{"Test Stack"}}, {{0, 255}, {256, 511}}))
return;
- auto glyphSet = test.glyphStore.getGlyphSet({{"Test Stack"}});
+ auto glyphSet = test.glyphAtlas.getGlyphSet({{"Test Stack"}});
ASSERT_FALSE(glyphSet->getSDFs().empty());
test.end();
@@ -65,8 +65,8 @@ TEST(GlyphStore, LoadingSuccess) {
{{0, 255}, {256, 511}});
}
-TEST(GlyphStore, LoadingFail) {
- GlyphStoreTest test;
+TEST(GlyphAtlas, LoadingFail) {
+ GlyphAtlasTest test;
test.fileSource.glyphsResponse = [&] (const Resource&) {
Response response;
@@ -83,9 +83,9 @@ TEST(GlyphStore, LoadingFail) {
EXPECT_TRUE(error != nullptr);
EXPECT_EQ(util::toString(error), "Failed by the test case");
- auto glyphSet = test.glyphStore.getGlyphSet({{"Test Stack"}});
+ auto glyphSet = test.glyphAtlas.getGlyphSet({{"Test Stack"}});
ASSERT_TRUE(glyphSet->getSDFs().empty());
- ASSERT_FALSE(test.glyphStore.hasGlyphRanges({{"Test Stack"}}, {{0, 255}}));
+ ASSERT_FALSE(test.glyphAtlas.hasGlyphRanges({{"Test Stack"}}, {{0, 255}}));
test.end();
};
@@ -96,8 +96,8 @@ TEST(GlyphStore, LoadingFail) {
{{0, 255}});
}
-TEST(GlyphStore, LoadingCorrupted) {
- GlyphStoreTest test;
+TEST(GlyphAtlas, LoadingCorrupted) {
+ GlyphAtlasTest test;
test.fileSource.glyphsResponse = [&] (const Resource&) {
Response response;
@@ -112,9 +112,9 @@ TEST(GlyphStore, LoadingCorrupted) {
EXPECT_TRUE(error != nullptr);
EXPECT_EQ(util::toString(error), "unknown pbf field type exception");
- auto glyphSet = test.glyphStore.getGlyphSet({{"Test Stack"}});
+ auto glyphSet = test.glyphAtlas.getGlyphSet({{"Test Stack"}});
ASSERT_TRUE(glyphSet->getSDFs().empty());
- ASSERT_FALSE(test.glyphStore.hasGlyphRanges({{"Test Stack"}}, {{0, 255}}));
+ ASSERT_FALSE(test.glyphAtlas.hasGlyphRanges({{"Test Stack"}}, {{0, 255}}));
test.end();
};
@@ -125,8 +125,8 @@ TEST(GlyphStore, LoadingCorrupted) {
{{0, 255}});
}
-TEST(GlyphStore, LoadingCancel) {
- GlyphStoreTest test;
+TEST(GlyphAtlas, LoadingCancel) {
+ GlyphAtlasTest test;
test.fileSource.glyphsResponse = [&] (const Resource&) {
test.end();