diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2015-07-06 16:35:58 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2015-07-08 19:46:03 +0200 |
commit | c66ec8739b0a0bfb22c59f05c6125717763c6f7e (patch) | |
tree | afe1b17fb372cf21410bf3928b43713cd5f8c8b6 /test/annotations | |
parent | 493c72b1f470f839ee6d9e56583c17837a9809a3 (diff) | |
download | qtlocation-mapboxgl-c66ec8739b0a0bfb22c59f05c6125717763c6f7e.tar.gz |
show info message when Sprite does not exist
Diffstat (limited to 'test/annotations')
-rw-r--r-- | test/annotations/sprite_atlas.cpp | 10 | ||||
-rw-r--r-- | test/annotations/sprite_store.cpp | 18 |
2 files changed, 28 insertions, 0 deletions
diff --git a/test/annotations/sprite_atlas.cpp b/test/annotations/sprite_atlas.cpp index c2a566f2ff..16140b0517 100644 --- a/test/annotations/sprite_atlas.cpp +++ b/test/annotations/sprite_atlas.cpp @@ -1,4 +1,5 @@ #include "../fixtures/util.hpp" +#include "../fixtures/fixture_log_observer.hpp" #include <mbgl/geometry/sprite_atlas.hpp> #include <mbgl/annotation/sprite_store.hpp> @@ -9,6 +10,8 @@ using namespace mbgl; TEST(Annotations, SpriteAtlas) { + FixtureLog log; + SpriteStore store; store.setSprites(parseSprite(util::read_file("test/fixtures/annotations/emerald.png"), util::read_file("test/fixtures/annotations/emerald.json"))); @@ -56,6 +59,13 @@ TEST(Annotations, SpriteAtlas) { EXPECT_EQ(0, missing.pos.originalH); EXPECT_FALSE(missing.texture); + EXPECT_EQ(1u, log.count({ + EventSeverity::Info, + Event::Sprite, + int64_t(-1), + "Can't find sprite named 'doesnotexist'", + })); + // Different wrapping mode produces different image. auto metro2 = atlas.getImage("metro", true); EXPECT_EQ(20, metro2.pos.x); diff --git a/test/annotations/sprite_store.cpp b/test/annotations/sprite_store.cpp index 2f589fa136..16eaad2499 100644 --- a/test/annotations/sprite_store.cpp +++ b/test/annotations/sprite_store.cpp @@ -6,6 +6,8 @@ using namespace mbgl; TEST(Annotations, SpriteStore) { + FixtureLog log; + const auto sprite1 = std::make_shared<SpriteImage>(8, 8, 2, std::string(16 * 16 * 4, '\0')); const auto sprite2 = std::make_shared<SpriteImage>(8, 8, 2, std::string(16 * 16 * 4, '\0')); const auto sprite3 = std::make_shared<SpriteImage>(8, 8, 2, std::string(16 * 16 * 4, '\0')); @@ -41,9 +43,25 @@ TEST(Annotations, SpriteStore) { // Accessing EXPECT_EQ(sprite3, store.getSprite("three")); + + EXPECT_TRUE(log.empty()); + EXPECT_EQ(nullptr, store.getSprite("two")); EXPECT_EQ(nullptr, store.getSprite("four")); + EXPECT_EQ(1u, log.count({ + EventSeverity::Info, + Event::Sprite, + int64_t(-1), + "Can't find sprite named 'two'", + })); + EXPECT_EQ(1u, log.count({ + EventSeverity::Info, + Event::Sprite, + int64_t(-1), + "Can't find sprite named 'four'", + })); + // Overwriting store.setSprite("three", sprite1); EXPECT_EQ(Sprites({ |