summaryrefslogtreecommitdiff
path: root/test/annotations
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2015-06-24 18:16:18 +0200
committerKonstantin Käfer <mail@kkaefer.com>2015-07-08 19:46:00 +0200
commit33a3388ccd07168da8169f5653d40d4ee623cf8e (patch)
treeae7ad950f31d351f6e5aa8e6922e0d2f84452e5d /test/annotations
parent54aaa43b6df0303ef9858839e4bbc7ae27a8c202 (diff)
downloadqtlocation-mapboxgl-33a3388ccd07168da8169f5653d40d4ee623cf8e.tar.gz
add API for adding multiple sprites at once
Diffstat (limited to 'test/annotations')
-rw-r--r--test/annotations/sprite_store.cpp40
1 files changed, 29 insertions, 11 deletions
diff --git a/test/annotations/sprite_store.cpp b/test/annotations/sprite_store.cpp
index b22c46be48..ff34a94b5d 100644
--- a/test/annotations/sprite_store.cpp
+++ b/test/annotations/sprite_store.cpp
@@ -16,26 +16,27 @@ TEST(Annotations, SpriteStore) {
// Adding single
store.setSprite("one", sprite1);
EXPECT_EQ(Sprites({
- { "one", sprite1 },
- }), store.getDirty());
+ { "one", sprite1 },
+ }),
+ store.getDirty());
EXPECT_EQ(Sprites(), store.getDirty());
// Adding multiple
store.setSprite("two", sprite2);
store.setSprite("three", sprite3);
EXPECT_EQ(Sprites({
- { "two", sprite2 },
- { "three", sprite3 },
- }), store.getDirty());
+ { "two", sprite2 }, { "three", sprite3 },
+ }),
+ store.getDirty());
EXPECT_EQ(Sprites(), store.getDirty());
// Removing
store.removeSprite("one");
store.removeSprite("two");
EXPECT_EQ(Sprites({
- { "one", nullptr },
- { "two", nullptr },
- }), store.getDirty());
+ { "one", nullptr }, { "two", nullptr },
+ }),
+ store.getDirty());
EXPECT_EQ(Sprites(), store.getDirty());
// Accessing
@@ -46,12 +47,12 @@ TEST(Annotations, SpriteStore) {
// Overwriting
store.setSprite("three", sprite1);
EXPECT_EQ(Sprites({
- { "three", sprite1 },
- }), store.getDirty());
+ { "three", sprite1 },
+ }),
+ store.getDirty());
EXPECT_EQ(Sprites(), store.getDirty());
}
-
TEST(Annotations, SpriteStoreWrongPixelRatio) {
FixtureLog log;
@@ -71,3 +72,20 @@ TEST(Annotations, SpriteStoreWrongPixelRatio) {
"Sprite image has wrong pixel ratio",
}));
}
+
+TEST(Annotations, SpriteStoreMultiple) {
+ 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'));
+
+ using Sprites = std::map<std::string, std::shared_ptr<const SpriteImage>>;
+ SpriteStore store(2);
+
+ store.setSprites({
+ { "one", sprite1 }, { "two", sprite2 },
+ });
+ EXPECT_EQ(Sprites({
+ { "one", sprite1 }, { "two", sprite2 },
+ }),
+ store.getDirty());
+ EXPECT_EQ(Sprites(), store.getDirty());
+}