summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2015-07-06 13:55:46 +0200
committerKonstantin Käfer <mail@kkaefer.com>2015-07-08 19:46:02 +0200
commit0d4cfd5bd6bba539decdffe489a8763a00062e0a (patch)
tree274590ef86c58d5de64762b4c9bebaa05fc11355 /test
parentd37bd549bc4bcaa80df667e6e218251607d94586 (diff)
downloadqtlocation-mapboxgl-0d4cfd5bd6bba539decdffe489a8763a00062e0a.tar.gz
test for sprite image that doesn't exist
Diffstat (limited to 'test')
-rw-r--r--test/annotations/sprite_atlas.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/annotations/sprite_atlas.cpp b/test/annotations/sprite_atlas.cpp
index 6334c47e31..e26595a946 100644
--- a/test/annotations/sprite_atlas.cpp
+++ b/test/annotations/sprite_atlas.cpp
@@ -63,6 +63,17 @@ TEST(Annotations, SpriteAtlas) {
EXPECT_DOUBLE_EQ(21.0f / 63, pos.br[0]);
EXPECT_DOUBLE_EQ(21.0f / 112, pos.br[1]);
+
+ auto missing = atlas.getImage("doesnotexist", false);
+ EXPECT_FALSE(missing.pos.hasArea());
+ EXPECT_EQ(0, missing.pos.x);
+ EXPECT_EQ(0, missing.pos.y);
+ EXPECT_EQ(0, missing.pos.w);
+ EXPECT_EQ(0, missing.pos.h);
+ EXPECT_EQ(0, missing.pos.originalW);
+ EXPECT_EQ(0, missing.pos.originalH);
+ EXPECT_FALSE(missing.texture);
+
// Different wrapping mode produces different image.
auto metro2 = atlas.getImage("metro", true);
EXPECT_EQ(20, metro2.pos.x);
@@ -74,7 +85,7 @@ TEST(Annotations, SpriteAtlas) {
const size_t bytes = atlas.getTextureWidth() * atlas.getTextureHeight() * 4;
const auto hash = crc64(reinterpret_cast<const char*>(atlas.getData()), bytes);
- EXPECT_EQ(0x9875fc0595489a9fu, hash) << std::hex << hash;
+ EXPECT_EQ(0x9875FC0595489A9Fu, hash) << std::hex << hash;
// util::write_file(
// "test/fixtures/annotations/atlas1.png",