From 0d4cfd5bd6bba539decdffe489a8763a00062e0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Mon, 6 Jul 2015 13:55:46 +0200 Subject: test for sprite image that doesn't exist --- test/annotations/sprite_atlas.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'test') 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(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", -- cgit v1.2.1