diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-06-01 10:30:49 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-06-13 10:18:43 -0700 |
commit | 92252849c1a2ddf7887d1908841fa3c90dd59766 (patch) | |
tree | 9d192d0e60b46479122ea2e4a606b598287d49d7 /test | |
parent | b201a7900f989af432aaea500a0e6c5ea5bbba53 (diff) | |
download | qtlocation-mapboxgl-92252849c1a2ddf7887d1908841fa3c90dd59766.tar.gz |
[core] Per-bucket glyph atlases
Diffstat (limited to 'test')
-rw-r--r-- | test/style/source.test.cpp | 6 | ||||
-rw-r--r-- | test/text/glyph_loader.test.cpp (renamed from test/text/glyph_atlas.test.cpp) | 54 | ||||
-rw-r--r-- | test/tile/annotation_tile.test.cpp | 6 | ||||
-rw-r--r-- | test/tile/geojson_tile.test.cpp | 6 | ||||
-rw-r--r-- | test/tile/raster_tile.test.cpp | 6 | ||||
-rw-r--r-- | test/tile/vector_tile.test.cpp | 6 |
6 files changed, 42 insertions, 42 deletions
diff --git a/test/style/source.test.cpp b/test/style/source.test.cpp index 0ab98a63b1..630d701299 100644 --- a/test/style/source.test.cpp +++ b/test/style/source.test.cpp @@ -32,7 +32,7 @@ #include <mbgl/annotation/annotation_manager.hpp> #include <mbgl/annotation/annotation_source.hpp> #include <mbgl/sprite/sprite_atlas.hpp> -#include <mbgl/text/glyph_atlas.hpp> +#include <mbgl/text/glyph_manager.hpp> #include <cstdint> @@ -49,7 +49,7 @@ public: ThreadPool threadPool { 1 }; AnnotationManager annotationManager; SpriteAtlas spriteAtlas; - GlyphAtlas glyphAtlas { { 512, 512, }, fileSource }; + GlyphManager glyphManager { fileSource }; TileParameters tileParameters { 1.0, @@ -60,7 +60,7 @@ public: MapMode::Continuous, annotationManager, spriteAtlas, - glyphAtlas + glyphManager }; SourceTest() { diff --git a/test/text/glyph_atlas.test.cpp b/test/text/glyph_loader.test.cpp index 01e0f115c0..be197ebb46 100644 --- a/test/text/glyph_atlas.test.cpp +++ b/test/text/glyph_loader.test.cpp @@ -1,7 +1,7 @@ #include <mbgl/test/util.hpp> #include <mbgl/test/stub_file_source.hpp> -#include <mbgl/text/glyph_atlas.hpp> +#include <mbgl/text/glyph_manager.hpp> #include <mbgl/util/run_loop.hpp> #include <mbgl/util/string.hpp> #include <mbgl/util/io.hpp> @@ -9,7 +9,7 @@ using namespace mbgl; -class StubGlyphAtlasObserver : public GlyphAtlasObserver { +class StubGlyphManagerObserver : public GlyphManagerObserver { public: void onGlyphsLoaded(const FontStack& fontStack, const GlyphRange& glyphRange) override { if (glyphsLoaded) glyphsLoaded(fontStack, glyphRange); @@ -25,28 +25,28 @@ public: class StubGlyphRequestor : public GlyphRequestor { public: - void onGlyphsAvailable(GlyphPositionMap positions) override { - if (glyphsAvailable) glyphsAvailable(std::move(positions)); + void onGlyphsAvailable(GlyphMap glyphs) override { + if (glyphsAvailable) glyphsAvailable(std::move(glyphs)); } - std::function<void (GlyphPositionMap)> glyphsAvailable; + std::function<void (GlyphMap)> glyphsAvailable; }; -class GlyphAtlasTest { +class GlyphManagerTest { public: util::RunLoop loop; StubFileSource fileSource; - StubGlyphAtlasObserver observer; + StubGlyphManagerObserver observer; StubGlyphRequestor requestor; - GlyphAtlas glyphAtlas{ { 32, 32 }, fileSource }; + GlyphManager glyphManager { fileSource }; void run(const std::string& url, GlyphDependencies dependencies) { // Squelch logging. Log::setObserver(std::make_unique<Log::NullObserver>()); - glyphAtlas.setURL(url); - glyphAtlas.setObserver(&observer); - glyphAtlas.getGlyphs(requestor, std::move(dependencies)); + glyphManager.setURL(url); + glyphManager.setObserver(&observer); + glyphManager.getGlyphs(requestor, std::move(dependencies)); loop.run(); } @@ -56,8 +56,8 @@ public: } }; -TEST(GlyphAtlas, LoadingSuccess) { - GlyphAtlasTest test; +TEST(GlyphManager, LoadingSuccess) { + GlyphManagerTest test; test.fileSource.glyphsResponse = [&] (const Resource& resource) { EXPECT_EQ(Resource::Kind::Glyphs, resource.kind); @@ -76,8 +76,8 @@ TEST(GlyphAtlas, LoadingSuccess) { ASSERT_EQ(range, GlyphRange(0, 255)); }; - test.requestor.glyphsAvailable = [&] (GlyphPositionMap positions) { - const auto& testPositions = positions.at({{"Test Stack"}}); + test.requestor.glyphsAvailable = [&] (GlyphMap glyphs) { + const auto& testPositions = glyphs.at({{"Test Stack"}}); ASSERT_EQ(testPositions.size(), 3u); ASSERT_EQ(testPositions.count(u'a'), 1u); @@ -95,8 +95,8 @@ TEST(GlyphAtlas, LoadingSuccess) { }); } -TEST(GlyphAtlas, LoadingFail) { - GlyphAtlasTest test; +TEST(GlyphManager, LoadingFail) { + GlyphManagerTest test; test.fileSource.glyphsResponse = [&] (const Resource&) { Response response; @@ -116,7 +116,7 @@ TEST(GlyphAtlas, LoadingFail) { test.end(); }; - test.requestor.glyphsAvailable = [&] (GlyphPositionMap) { + test.requestor.glyphsAvailable = [&] (GlyphMap) { FAIL(); test.end(); }; @@ -128,8 +128,8 @@ TEST(GlyphAtlas, LoadingFail) { }); } -TEST(GlyphAtlas, LoadingCorrupted) { - GlyphAtlasTest test; +TEST(GlyphManager, LoadingCorrupted) { + GlyphManagerTest test; test.fileSource.glyphsResponse = [&] (const Resource&) { Response response; @@ -147,7 +147,7 @@ TEST(GlyphAtlas, LoadingCorrupted) { test.end(); }; - test.requestor.glyphsAvailable = [&] (GlyphPositionMap) { + test.requestor.glyphsAvailable = [&] (GlyphMap) { FAIL(); test.end(); }; @@ -159,8 +159,8 @@ TEST(GlyphAtlas, LoadingCorrupted) { }); } -TEST(GlyphAtlas, LoadingCancel) { - GlyphAtlasTest test; +TEST(GlyphManager, LoadingCancel) { + GlyphManagerTest test; test.fileSource.glyphsResponse = [&] (const Resource&) { test.end(); @@ -178,8 +178,8 @@ TEST(GlyphAtlas, LoadingCancel) { }); } -TEST(GlyphAtlas, LoadingInvalid) { - GlyphAtlasTest test; +TEST(GlyphManager, LoadingInvalid) { + GlyphManagerTest test; test.fileSource.glyphsResponse = [&] (const Resource& resource) { EXPECT_EQ(Resource::Kind::Glyphs, resource.kind); @@ -198,8 +198,8 @@ TEST(GlyphAtlas, LoadingInvalid) { ASSERT_EQ(range, GlyphRange(0, 255)); }; - test.requestor.glyphsAvailable = [&] (GlyphPositionMap positions) { - const auto& testPositions = positions.at({{"Test Stack"}}); + test.requestor.glyphsAvailable = [&] (GlyphMap glyphs) { + const auto& testPositions = glyphs.at({{"Test Stack"}}); ASSERT_EQ(testPositions.size(), 2u); ASSERT_FALSE(bool(testPositions.at(u'A'))); diff --git a/test/tile/annotation_tile.test.cpp b/test/tile/annotation_tile.test.cpp index 927799b26d..168dbf5292 100644 --- a/test/tile/annotation_tile.test.cpp +++ b/test/tile/annotation_tile.test.cpp @@ -13,7 +13,7 @@ #include <mbgl/annotation/annotation_manager.hpp> #include <mbgl/annotation/annotation_tile.hpp> #include <mbgl/sprite/sprite_atlas.hpp> -#include <mbgl/text/glyph_atlas.hpp> +#include <mbgl/text/glyph_manager.hpp> #include <memory> @@ -28,7 +28,7 @@ public: AnnotationManager annotationManager; RenderStyle style { threadPool, fileSource }; SpriteAtlas spriteAtlas; - GlyphAtlas glyphAtlas { { 512, 512, }, fileSource }; + GlyphManager glyphManager { fileSource }; TileParameters tileParameters { 1.0, @@ -39,7 +39,7 @@ public: MapMode::Continuous, annotationManager, spriteAtlas, - glyphAtlas + glyphManager }; }; diff --git a/test/tile/geojson_tile.test.cpp b/test/tile/geojson_tile.test.cpp index 92068d5e43..9a9fe9a78f 100644 --- a/test/tile/geojson_tile.test.cpp +++ b/test/tile/geojson_tile.test.cpp @@ -11,7 +11,7 @@ #include <mbgl/style/layers/circle_layer.hpp> #include <mbgl/annotation/annotation_manager.hpp> #include <mbgl/sprite/sprite_atlas.hpp> -#include <mbgl/text/glyph_atlas.hpp> +#include <mbgl/text/glyph_manager.hpp> #include <memory> @@ -26,7 +26,7 @@ public: ThreadPool threadPool { 1 }; AnnotationManager annotationManager; SpriteAtlas spriteAtlas; - GlyphAtlas glyphAtlas { { 512, 512, }, fileSource }; + GlyphManager glyphManager { fileSource }; Tileset tileset { { "https://example.com" }, { 0, 22 }, "none" }; TileParameters tileParameters { @@ -38,7 +38,7 @@ public: MapMode::Continuous, annotationManager, spriteAtlas, - glyphAtlas + glyphManager }; }; diff --git a/test/tile/raster_tile.test.cpp b/test/tile/raster_tile.test.cpp index 1bd35700b3..ba296c0360 100644 --- a/test/tile/raster_tile.test.cpp +++ b/test/tile/raster_tile.test.cpp @@ -10,7 +10,7 @@ #include <mbgl/renderer/tile_parameters.hpp> #include <mbgl/renderer/buckets/raster_bucket.hpp> #include <mbgl/sprite/sprite_atlas.hpp> -#include <mbgl/text/glyph_atlas.hpp> +#include <mbgl/text/glyph_manager.hpp> using namespace mbgl; @@ -22,7 +22,7 @@ public: ThreadPool threadPool { 1 }; AnnotationManager annotationManager; SpriteAtlas spriteAtlas; - GlyphAtlas glyphAtlas { { 512, 512, }, fileSource }; + GlyphManager glyphManager { fileSource }; Tileset tileset { { "https://example.com" }, { 0, 22 }, "none" }; TileParameters tileParameters { @@ -34,7 +34,7 @@ public: MapMode::Continuous, annotationManager, spriteAtlas, - glyphAtlas + glyphManager }; }; diff --git a/test/tile/vector_tile.test.cpp b/test/tile/vector_tile.test.cpp index a44eeb9001..e1a1635bd3 100644 --- a/test/tile/vector_tile.test.cpp +++ b/test/tile/vector_tile.test.cpp @@ -14,7 +14,7 @@ #include <mbgl/geometry/feature_index.hpp> #include <mbgl/annotation/annotation_manager.hpp> #include <mbgl/sprite/sprite_atlas.hpp> -#include <mbgl/text/glyph_atlas.hpp> +#include <mbgl/text/glyph_manager.hpp> #include <memory> @@ -28,7 +28,7 @@ public: ThreadPool threadPool { 1 }; AnnotationManager annotationManager; SpriteAtlas spriteAtlas; - GlyphAtlas glyphAtlas { { 512, 512, }, fileSource }; + GlyphManager glyphManager { fileSource }; Tileset tileset { { "https://example.com" }, { 0, 22 }, "none" }; TileParameters tileParameters { @@ -40,7 +40,7 @@ public: MapMode::Continuous, annotationManager, spriteAtlas, - glyphAtlas + glyphManager }; }; |