diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-05-12 13:01:00 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-05-13 09:28:53 -0700 |
commit | b3ec985568176b077756b66754470988436d43c1 (patch) | |
tree | 45638ff9787938cd34240542e95e51509773edbf /test/text | |
parent | 84e39611a096058826dbdb89dccbd1affad05f76 (diff) | |
download | qtlocation-mapboxgl-b3ec985568176b077756b66754470988436d43c1.tar.gz |
[core] Trim StyleObserver interface
It doesn't need to inherit from SpriteLoaderObserver and GlyphAtlasObserver.
Diffstat (limited to 'test/text')
-rw-r--r-- | test/text/glyph_atlas.test.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/test/text/glyph_atlas.test.cpp b/test/text/glyph_atlas.test.cpp index 5aff1ee441..01e0f115c0 100644 --- a/test/text/glyph_atlas.test.cpp +++ b/test/text/glyph_atlas.test.cpp @@ -1,6 +1,5 @@ #include <mbgl/test/util.hpp> #include <mbgl/test/stub_file_source.hpp> -#include <mbgl/test/stub_style_observer.hpp> #include <mbgl/text/glyph_atlas.hpp> #include <mbgl/util/run_loop.hpp> @@ -10,6 +9,20 @@ using namespace mbgl; +class StubGlyphAtlasObserver : public GlyphAtlasObserver { +public: + void onGlyphsLoaded(const FontStack& fontStack, const GlyphRange& glyphRange) override { + if (glyphsLoaded) glyphsLoaded(fontStack, glyphRange); + } + + void onGlyphsError(const FontStack& fontStack, const GlyphRange& glyphRange, std::exception_ptr error) override { + if (glyphsError) glyphsError(fontStack, glyphRange, error); + } + + std::function<void (const FontStack&, const GlyphRange&)> glyphsLoaded; + std::function<void (const FontStack&, const GlyphRange&, std::exception_ptr)> glyphsError; +}; + class StubGlyphRequestor : public GlyphRequestor { public: void onGlyphsAvailable(GlyphPositionMap positions) override { @@ -23,7 +36,7 @@ class GlyphAtlasTest { public: util::RunLoop loop; StubFileSource fileSource; - StubStyleObserver observer; + StubGlyphAtlasObserver observer; StubGlyphRequestor requestor; GlyphAtlas glyphAtlas{ { 32, 32 }, fileSource }; |