From 54aaa43b6df0303ef9858839e4bbc7ae27a8c202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Wed, 24 Jun 2015 18:10:55 +0200 Subject: add test for trying to add mismatched SpriteImage --- test/annotations/sprite_store.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test') 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 @@ -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(8, 8, 1, std::string(8 * 8 * 4, '\0')); + + using Sprites = std::map>; + 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", + })); +} -- cgit v1.2.1