summaryrefslogtreecommitdiff
path: root/test/annotations
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2015-06-24 18:10:55 +0200
committerKonstantin Käfer <mail@kkaefer.com>2015-07-08 19:46:00 +0200
commit54aaa43b6df0303ef9858839e4bbc7ae27a8c202 (patch)
treeea67783938a26f9ff3b2383402c0a3d032be0a2f /test/annotations
parent04d57b8ef2e3c3142c08c6d4f50c87ec93434626 (diff)
downloadqtlocation-mapboxgl-54aaa43b6df0303ef9858839e4bbc7ae27a8c202.tar.gz
add test for trying to add mismatched SpriteImage
Diffstat (limited to 'test/annotations')
-rw-r--r--test/annotations/sprite_store.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/annotations/sprite_store.cpp b/test/annotations/sprite_store.cpp
index 287efaedab..b22c46be48 100644
--- a/test/annotations/sprite_store.cpp
+++ b/test/annotations/sprite_store.cpp
@@ -1,4 +1,5 @@
#include "../fixtures/util.hpp"
+#include "../fixtures/fixture_log_observer.hpp"
#include <mbgl/annotation/sprite_store.hpp>
@@ -49,3 +50,24 @@ TEST(Annotations, SpriteStore) {
}), store.getDirty());
EXPECT_EQ(Sprites(), store.getDirty());
}
+
+
+TEST(Annotations, SpriteStoreWrongPixelRatio) {
+ FixtureLog log;
+
+ const auto sprite1 = std::make_shared<SpriteImage>(8, 8, 1, std::string(8 * 8 * 4, '\0'));
+
+ using Sprites = std::map<std::string, std::shared_ptr<const SpriteImage>>;
+ SpriteStore store(2);
+
+ // Adding mismatched sprite image
+ store.setSprite("one", sprite1);
+ EXPECT_EQ(Sprites({}), store.getDirty());
+
+ EXPECT_EQ(1u, log.count({
+ EventSeverity::Warning,
+ Event::Sprite,
+ int64_t(-1),
+ "Sprite image has wrong pixel ratio",
+ }));
+}