summaryrefslogtreecommitdiff
path: root/src/resources/map/speciallayer_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources/map/speciallayer_unittest.cc')
-rw-r--r--src/resources/map/speciallayer_unittest.cc45
1 files changed, 43 insertions, 2 deletions
diff --git a/src/resources/map/speciallayer_unittest.cc b/src/resources/map/speciallayer_unittest.cc
index 3e1b42043..b74ade7dc 100644
--- a/src/resources/map/speciallayer_unittest.cc
+++ b/src/resources/map/speciallayer_unittest.cc
@@ -62,8 +62,9 @@ TEST_CASE("SpecialLayer updateCache")
{
layer = new SpecialLayer("test",
1, 1);
- layer->setTile(0, 0, MapItemType::ARROW_UP);
const int *const cache = layer->getCache();
+ REQUIRE(cache[0] == 10000);
+ layer->setTile(0, 0, MapItemType::ARROW_UP);
layer->updateCache();
REQUIRE(cache[0] == 10000);
}
@@ -72,8 +73,10 @@ TEST_CASE("SpecialLayer updateCache")
{
layer = new SpecialLayer("test",
2, 1);
- layer->setTile(0, 0, MapItemType::ARROW_UP);
const int *const cache = layer->getCache();
+ REQUIRE(cache[0] == 10000);
+ REQUIRE(cache[1] == 10000);
+ layer->setTile(0, 0, MapItemType::ARROW_UP);
layer->updateCache();
REQUIRE(cache[0] == 10000);
REQUIRE(cache[1] == 10000);
@@ -143,6 +146,44 @@ TEST_CASE("SpecialLayer updateCache")
REQUIRE(cache[2] == 10000);
}
+ SECTION("simple 7")
+ {
+ layer = new SpecialLayer("test",
+ 3, 1);
+ const int *const cache = layer->getCache();
+ layer->updateCache();
+ REQUIRE(cache[0] == 10000);
+ REQUIRE(cache[1] == 10000);
+ REQUIRE(cache[2] == 10000);
+ }
+
+ SECTION("simple 8")
+ {
+ layer = new SpecialLayer("test",
+ 3, 1);
+ layer->setTile(0, 0, MapItemType::EMPTY);
+ layer->setTile(1, 0, MapItemType::EMPTY);
+ layer->setTile(2, 0, MapItemType::EMPTY);
+ const int *const cache = layer->getCache();
+ layer->updateCache();
+ REQUIRE(cache[0] == 10000);
+ REQUIRE(cache[1] == 10000);
+ REQUIRE(cache[2] == 10000);
+ }
+
+ SECTION("simple 9")
+ {
+ layer = new SpecialLayer("test",
+ 2, 1);
+ const int *const cache = layer->getCache();
+ REQUIRE(cache[0] == 10000);
+ REQUIRE(cache[1] == 10000);
+ layer->setTile(1, 0, MapItemType::ARROW_UP);
+ layer->updateCache();
+ REQUIRE(cache[0] == 0);
+ REQUIRE(cache[1] == 10000);
+ }
+
SECTION("normal 1")
{
layer = new SpecialLayer("test",