summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-02-20 15:51:27 +0300
committerAndrei Karas <akaras@inbox.ru>2017-02-20 15:51:27 +0300
commitcf772ab6f9fdfe1647b9b7b79aab685ebc831f31 (patch)
tree25cdb35a8733efe3a4cb90e36cbb89e8e0c24c10 /src/resources
parent80ba4766d8ce9861f6d026e791abc741e3fed0f4 (diff)
downloadmanaplus-cf772ab6f9fdfe1647b9b7b79aab685ebc831f31.tar.gz
manaplus-cf772ab6f9fdfe1647b9b7b79aab685ebc831f31.tar.bz2
manaplus-cf772ab6f9fdfe1647b9b7b79aab685ebc831f31.tar.xz
manaplus-cf772ab6f9fdfe1647b9b7b79aab685ebc831f31.zip
Fix some leaks in unit tests.
Add support for suppression some leaks in asan.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/dye/dye_unittest.cc1
-rw-r--r--src/resources/dye/dyepalette_unittest.cc1
-rw-r--r--src/resources/map/maplayer_unittest.cc9
-rw-r--r--src/resources/map/speciallayer_unittest.cc3
-rw-r--r--src/resources/resourcemanager/resourcemanager_unittest.cc5
-rw-r--r--src/resources/sprite/animatedsprite_unittest.cc5
6 files changed, 19 insertions, 5 deletions
diff --git a/src/resources/dye/dye_unittest.cc b/src/resources/dye/dye_unittest.cc
index 57892c3a9..5f38aa77a 100644
--- a/src/resources/dye/dye_unittest.cc
+++ b/src/resources/dye/dye_unittest.cc
@@ -2391,5 +2391,6 @@ TEST_CASE("Dye real dye")
dyeCheck("|A:#0000FFFF,FF000050", "arrow_up_A.png");
}
delete2(client);
+ delete2(logger);
// VirtFs::deinit();
}
diff --git a/src/resources/dye/dyepalette_unittest.cc b/src/resources/dye/dyepalette_unittest.cc
index 88bffe824..9431f0d72 100644
--- a/src/resources/dye/dyepalette_unittest.cc
+++ b/src/resources/dye/dyepalette_unittest.cc
@@ -381,5 +381,6 @@ TEST_CASE("DyePalette tests")
REQUIRE(palette.mColors[0].value[3] == 0x77);
}
delete2(client);
+ delete2(logger);
// VirtFs::deinit();
}
diff --git a/src/resources/map/maplayer_unittest.cc b/src/resources/map/maplayer_unittest.cc
index 75bd20219..5d7f5c258 100644
--- a/src/resources/map/maplayer_unittest.cc
+++ b/src/resources/map/maplayer_unittest.cc
@@ -28,6 +28,7 @@
#include "gui/theme.h"
+#include "utils/delete2.h"
#include "utils/virtfs.h"
#include "render/mockgraphics.h"
@@ -1646,6 +1647,7 @@ TEST_CASE("MapLayer draw")
TEST_CASE("MapLayer drawSpecialLayer (specialLayer)")
{
+ logger = new Logger;
ResourceManager::init();
VirtFs::addDirToSearchPath("data", Append_false);
VirtFs::addDirToSearchPath("../data", Append_false);
@@ -1990,10 +1992,12 @@ TEST_CASE("MapLayer drawSpecialLayer (specialLayer)")
delete map;
delete mock;
+ delete2(logger);
}
TEST_CASE("MapLayer drawSpecialLayer (tempLayer)")
{
+ logger = new Logger;
ResourceManager::init();
VirtFs::addDirToSearchPath("data", Append_false);
VirtFs::addDirToSearchPath("../data", Append_false);
@@ -2344,14 +2348,15 @@ TEST_CASE("MapLayer drawSpecialLayer (tempLayer)")
delete map;
delete mock;
+ delete2(logger);
}
TEST_CASE("MapLayer drawFringe")
{
+ logger = new Logger;
ResourceManager::init();
VirtFs::addDirToSearchPath("data", Append_false);
VirtFs::addDirToSearchPath("../data", Append_false);
- logger = new Logger;
imageHelper = new SDLImageHelper;
#ifdef USE_SDL2
@@ -3220,9 +3225,11 @@ TEST_CASE("MapLayer drawFringe")
REQUIRE(mock->mDraws[7].image == img1);
}
+ delete2(localPlayer);
delete map;
delete img1;
delete img2;
delete img3;
delete mock;
+ delete2(logger);
}
diff --git a/src/resources/map/speciallayer_unittest.cc b/src/resources/map/speciallayer_unittest.cc
index 6c6772332..70f3d07e1 100644
--- a/src/resources/map/speciallayer_unittest.cc
+++ b/src/resources/map/speciallayer_unittest.cc
@@ -20,6 +20,7 @@
#include "catch.hpp"
#include "client.h"
+#include "logger.h"
#include "graphicsmanager.h"
@@ -40,6 +41,7 @@
TEST_CASE("SpecialLayer updateCache")
{
+ logger = new Logger;
client = new Client;
ResourceManager::init();
VirtFs::addDirToSearchPath("data", Append_false);
@@ -259,4 +261,5 @@ TEST_CASE("SpecialLayer updateCache")
delete layer;
resourceManager->cleanOrphans();
delete2(client);
+ delete2(logger);
}
diff --git a/src/resources/resourcemanager/resourcemanager_unittest.cc b/src/resources/resourcemanager/resourcemanager_unittest.cc
index 98ed0ca2f..56f055b86 100644
--- a/src/resources/resourcemanager/resourcemanager_unittest.cc
+++ b/src/resources/resourcemanager/resourcemanager_unittest.cc
@@ -30,6 +30,7 @@
#include "resources/resourcemanager/resourcemanager.h"
#include "utils/env.h"
+#include "utils/delete2.h"
#include "utils/virtfs.h"
#include <unistd.h>
@@ -657,7 +658,7 @@ TEST_CASE("resourcemanager", "resourcemanager")
delete resourceManager;
resourceManager = safeResman;
- delete client;
- client = nullptr;
+ delete2(client);
+ delete2(logger);
// VirtFs::deinit();
}
diff --git a/src/resources/sprite/animatedsprite_unittest.cc b/src/resources/sprite/animatedsprite_unittest.cc
index 9505e7d24..8eeb2178d 100644
--- a/src/resources/sprite/animatedsprite_unittest.cc
+++ b/src/resources/sprite/animatedsprite_unittest.cc
@@ -40,6 +40,7 @@
#include "resources/resourcemanager/resourcemanager.h"
#include "utils/env.h"
+#include "utils/delete2.h"
#include "utils/mrand.h"
#include "utils/virtfs.h"
@@ -179,7 +180,7 @@ TEST_CASE("AnimatedSprite tests", "animatedsprite")
delete sprite2;
}
- delete client;
- client = nullptr;
+ delete2(client);
+ delete2(logger);
// VirtFs::deinit();
}