diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2019-03-07 23:24:52 +0200 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2019-03-08 18:37:41 +0200 |
commit | 2144e3f3b0b8f08b65c854225d7360847633f689 (patch) | |
tree | 16cadc63b1c3d438c5ddd4bf67aadb2e72e23130 /test/text/local_glyph_rasterizer.test.cpp | |
parent | 2f88e8257b83b77f6c06c86c99f542976e7d5199 (diff) | |
download | qtlocation-mapboxgl-2144e3f3b0b8f08b65c854225d7360847633f689.tar.gz |
[core] Implement platform::Factory::sharedFileSource()upstream/map-refactor
Diffstat (limited to 'test/text/local_glyph_rasterizer.test.cpp')
-rw-r--r-- | test/text/local_glyph_rasterizer.test.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/test/text/local_glyph_rasterizer.test.cpp b/test/text/local_glyph_rasterizer.test.cpp index 5c03945b8c..0d69ff5697 100644 --- a/test/text/local_glyph_rasterizer.test.cpp +++ b/test/text/local_glyph_rasterizer.test.cpp @@ -2,6 +2,7 @@ #include <mbgl/test/stub_file_source.hpp> #include <mbgl/map/map.hpp> #include <mbgl/map/map_options.hpp> +#include <mbgl/platform/factory.hpp> #include <mbgl/util/io.hpp> #include <mbgl/util/run_loop.hpp> #include <mbgl/util/color.hpp> @@ -32,16 +33,18 @@ namespace { class LocalGlyphRasterizerTest { public: LocalGlyphRasterizerTest(const optional<std::string> fontFamily) - : frontend(pixelRatio, fileSource, optional<std::string>(), GLContextMode::Unique, fontFamily) + : frontend(pixelRatio, stubFileSourceOptions, optional<std::string>(), GLContextMode::Unique, fontFamily) { } util::RunLoop loop; - StubFileSource fileSource; + FileSourceOptions stubFileSourceOptions; + std::shared_ptr<FileSource> fileSource = platform::Factory::sharedFileSource( + stubFileSourceOptions, std::make_shared<StubFileSource>()); float pixelRatio { 1 }; - HeadlessFrontend frontend; - Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource, - MapOptions().withMapMode(MapMode::Static)}; + HeadlessFrontend frontend { pixelRatio, stubFileSourceOptions }; + Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, + MapOptions().withMapMode(MapMode::Static), stubFileSourceOptions }; void checkRendering(const char * name) { test::checkImage(std::string("test/fixtures/local_glyphs/") + name, @@ -57,7 +60,8 @@ public: TEST(LocalGlyphRasterizer, PingFang) { LocalGlyphRasterizerTest test(std::string("PingFang")); - test.fileSource.glyphsResponse = [&] (const Resource& resource) { + auto stubFileSource = std::static_pointer_cast<StubFileSource>(test.fileSource); + stubFileSource->glyphsResponse = [&] (const Resource& resource) { EXPECT_EQ(Resource::Kind::Glyphs, resource.kind); Response response; response.data = std::make_shared<std::string>(util::read_file("test/fixtures/resources/glyphs.pbf")); @@ -78,7 +82,8 @@ TEST(LocalGlyphRasterizer, NoLocal) { // the output should just contain basic latin characters. LocalGlyphRasterizerTest test({}); - test.fileSource.glyphsResponse = [&] (const Resource& resource) { + auto stubFileSource = std::static_pointer_cast<StubFileSource>(test.fileSource); + stubFileSource->glyphsResponse = [&] (const Resource& resource) { EXPECT_EQ(Resource::Kind::Glyphs, resource.kind); Response response; response.data = std::make_shared<std::string>(util::read_file("test/fixtures/resources/glyphs.pbf")); |