From b3ec985568176b077756b66754470988436d43c1 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Fri, 12 May 2017 13:01:00 -0700 Subject: [core] Trim StyleObserver interface It doesn't need to inherit from SpriteLoaderObserver and GlyphAtlasObserver. --- test/text/glyph_atlas.test.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'test/text') 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 #include -#include #include #include @@ -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 glyphsLoaded; + std::function 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 }; -- cgit v1.2.1