diff options
-rw-r--r-- | src/gui/fonts/textchunklist_unittest.cc | 18 | ||||
-rw-r--r-- | src/gui/widgets/browserbox_unittest.cc | 1 | ||||
-rw-r--r-- | src/integrity_unittest.cc | 4 | ||||
-rw-r--r-- | src/resources/map/maplayer_unittest.cc | 4 | ||||
-rw-r--r-- | src/resources/resource.h | 2 | ||||
-rw-r--r-- | src/utils/chatutils_unittest.cc | 2 |
6 files changed, 29 insertions, 2 deletions
diff --git a/src/gui/fonts/textchunklist_unittest.cc b/src/gui/fonts/textchunklist_unittest.cc index 44dbec297..fa573228f 100644 --- a/src/gui/fonts/textchunklist_unittest.cc +++ b/src/gui/fonts/textchunklist_unittest.cc @@ -57,6 +57,7 @@ TEST_CASE("TextChunkList add 1", "TextChunkList") REQUIRE(1 == list.searchWidth.size()); REQUIRE(chunk == (*list.searchWidth.find(chunk->text)).second); + delete chunk; } TEST_CASE("TextChunkList add 2", "TextChunkList") @@ -87,6 +88,8 @@ TEST_CASE("TextChunkList add 2", "TextChunkList") REQUIRE(1 == list.searchWidth.size()); REQUIRE(chunk1 == (*list.searchWidth.find(chunk1->text)).second); + delete chunk1; + delete chunk2; } TEST_CASE("TextChunkList addRemoveBack 1", "TextChunkList") @@ -131,6 +134,7 @@ TEST_CASE("TextChunkList addRemoveBack 2", "TextChunkList") REQUIRE(1 == list.searchWidth.size()); REQUIRE(chunk1 == (*list.searchWidth.find(chunk1->text)).second); + delete chunk1; } TEST_CASE("TextChunkList addRemoveBack 3", "TextChunkList") @@ -182,6 +186,7 @@ TEST_CASE("TextChunkList addRemoveBack 4", "TextChunkList") chunk1->text, chunk1->color, chunk1->color2))).second); REQUIRE(0 == list.searchWidth.size()); + delete chunk1; } TEST_CASE("TextChunkList moveToFirst 1", "TextChunkList") @@ -199,6 +204,7 @@ TEST_CASE("TextChunkList moveToFirst 1", "TextChunkList") REQUIRE(chunk == list.end); REQUIRE(nullptr == chunk->prev); REQUIRE(nullptr == chunk->next); + delete chunk; } TEST_CASE("TextChunkList moveToFirst 2", "TextChunkList") @@ -221,6 +227,8 @@ TEST_CASE("TextChunkList moveToFirst 2", "TextChunkList") REQUIRE(chunk2 == chunk1->next); REQUIRE(chunk1 == chunk2->prev); REQUIRE(nullptr == chunk2->next); + delete chunk1; + delete chunk2; } TEST_CASE("TextChunkList moveToFirst 3", "TextChunkList") @@ -248,6 +256,9 @@ TEST_CASE("TextChunkList moveToFirst 3", "TextChunkList") REQUIRE(chunk3 == chunk2->next); REQUIRE(chunk2 == chunk3->prev); REQUIRE(nullptr == chunk3->next); + delete chunk1; + delete chunk2; + delete chunk3; } TEST_CASE("TextChunkList moveToFirst 4", "TextChunkList") @@ -275,6 +286,9 @@ TEST_CASE("TextChunkList moveToFirst 4", "TextChunkList") REQUIRE(chunk3 == chunk2->next); REQUIRE(chunk2 == chunk3->prev); REQUIRE(nullptr == chunk3->next); + delete chunk1; + delete chunk2; + delete chunk3; } TEST_CASE("TextChunkList clear 1", "TextChunkList") @@ -427,6 +441,8 @@ TEST_CASE("TextChunkList remove 2", "TextChunkList") REQUIRE((chunksLeft + 2) == textChunkCnt); REQUIRE(2 == list.search.size()); REQUIRE(2 == list.searchWidth.size()); + delete chunk2; + delete chunk3; } TEST_CASE("TextChunkList remove 3", "TextChunkList") @@ -453,6 +469,8 @@ TEST_CASE("TextChunkList remove 3", "TextChunkList") REQUIRE((chunksLeft + 2) == textChunkCnt); REQUIRE(2 == list.search.size()); REQUIRE(2 == list.searchWidth.size()); + delete chunk1; + delete chunk3; } TEST_CASE("TextChunkList sort 1", "TextChunkList") diff --git a/src/gui/widgets/browserbox_unittest.cc b/src/gui/widgets/browserbox_unittest.cc index a3434427f..68a38300d 100644 --- a/src/gui/widgets/browserbox_unittest.cc +++ b/src/gui/widgets/browserbox_unittest.cc @@ -48,7 +48,6 @@ TEST_CASE("BrowserBox tests", "browserbox") dirSeparator = "/"; client = new Client; logger = new Logger(); - imageHelper = new SDLImageHelper(); ResourceManager::init(); VirtFs::addDirToSearchPath("data", Append_false); VirtFs::addDirToSearchPath("../data", Append_false); diff --git a/src/integrity_unittest.cc b/src/integrity_unittest.cc index f52e74ed8..158ce51fc 100644 --- a/src/integrity_unittest.cc +++ b/src/integrity_unittest.cc @@ -472,7 +472,7 @@ TEST_CASE("integrity tests", "integrity") VirtFs::removeZipFromSearchPath("data/test/test.zip"); VirtFs::removeZipFromSearchPath("../data/test/test.zip"); REQUIRE(res != nullptr); - res->decRef(); + delete res; } SECTION("integrity Loader::getImage test 10") @@ -488,6 +488,8 @@ TEST_CASE("integrity tests", "integrity") image->decRef(); } + resourceManager->cleanOrphans(true); + delete client; client = nullptr; diff --git a/src/resources/map/maplayer_unittest.cc b/src/resources/map/maplayer_unittest.cc index 5d7f5c258..f2efd49a6 100644 --- a/src/resources/map/maplayer_unittest.cc +++ b/src/resources/map/maplayer_unittest.cc @@ -1992,6 +1992,7 @@ TEST_CASE("MapLayer drawSpecialLayer (specialLayer)") delete map; delete mock; + GraphicsManager::deleteRenderers(); delete2(logger); } @@ -2348,6 +2349,7 @@ TEST_CASE("MapLayer drawSpecialLayer (tempLayer)") delete map; delete mock; + GraphicsManager::deleteRenderers(); delete2(logger); } @@ -3231,5 +3233,7 @@ TEST_CASE("MapLayer drawFringe") delete img2; delete img3; delete mock; + delete2(theme); + GraphicsManager::deleteRenderers(); delete2(logger); } diff --git a/src/resources/resource.h b/src/resources/resource.h index f90890e19..e9f7e0531 100644 --- a/src/resources/resource.h +++ b/src/resources/resource.h @@ -110,7 +110,9 @@ class Resource notfinal : public MemoryCounter { mDumped = n; } #endif // DEBUG_DUMP_LEAKS +#ifndef UNITTESTS protected: +#endif // UNITTESTS /** * Destructor. */ diff --git a/src/utils/chatutils_unittest.cc b/src/utils/chatutils_unittest.cc index f82fa1549..56d37e7a6 100644 --- a/src/utils/chatutils_unittest.cc +++ b/src/utils/chatutils_unittest.cc @@ -230,6 +230,8 @@ TEST_CASE("chatutils replaceVars") str = "test <PARTY>"; replaceVars(str); REQUIRE(str == "test player1,player3"); + + Party::clearParties(); } delete2(actorManager); |