diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-07-13 03:48:56 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-07-13 03:48:56 +0300 |
commit | b5cb8b8ed49f80ebbb82cacb55c16a03318db30b (patch) | |
tree | 0a2d308fdf870a8b0564b585087abaea867457ec | |
parent | 0d9761f9a6b375f6018a16b21cf2fbbb01155c08 (diff) | |
download | manaplus-b5cb8b8ed49f80ebbb82cacb55c16a03318db30b.tar.gz manaplus-b5cb8b8ed49f80ebbb82cacb55c16a03318db30b.tar.bz2 manaplus-b5cb8b8ed49f80ebbb82cacb55c16a03318db30b.tar.xz manaplus-b5cb8b8ed49f80ebbb82cacb55c16a03318db30b.zip |
Fix unit tests after latest changes.
-rw-r--r-- | src/resources/db/groupdb.cpp | 7 | ||||
-rw-r--r-- | src/resources/db/groupdb.h | 4 | ||||
-rw-r--r-- | src/unittests/fs/files_unittest.cc | 5 | ||||
-rw-r--r-- | src/unittests/gui/windowmanager_unittest.cc | 6 |
4 files changed, 20 insertions, 2 deletions
diff --git a/src/resources/db/groupdb.cpp b/src/resources/db/groupdb.cpp index ab9a2958d..4b25e94bd 100644 --- a/src/resources/db/groupdb.cpp +++ b/src/resources/db/groupdb.cpp @@ -127,3 +127,10 @@ const std::string &GroupDb::getLongName(const int id) } return (*it).second.longName; } + +#ifdef UNITTESTS +GroupDb::GroupInfos &GroupDb::getGroups() +{ + return mGroups; +} +#endif // UNITTESTS diff --git a/src/resources/db/groupdb.h b/src/resources/db/groupdb.h index 60667b3d8..f2c027120 100644 --- a/src/resources/db/groupdb.h +++ b/src/resources/db/groupdb.h @@ -42,6 +42,10 @@ namespace GroupDb const std::string &getLongName(const int id); typedef std::map<int, GroupInfo> GroupInfos; + +#ifdef UNITTESTS + GroupDb::GroupInfos &getGroups(); +#endif // UNITTESTS } // namespace GroupDb #endif // RESOURCES_DB_GROUPDB_H diff --git a/src/unittests/fs/files_unittest.cc b/src/unittests/fs/files_unittest.cc index 927891fdd..f3a15b174 100644 --- a/src/unittests/fs/files_unittest.cc +++ b/src/unittests/fs/files_unittest.cc @@ -217,13 +217,14 @@ TEST_CASE("Files getFilesInDir", "") VirtFs::getFilesInDir("perserver/default", list, ".xml"); - REQUIRE(list.size() == 5); + REQUIRE(list.size() == 6); REQUIRE(list[0] == pathJoin("perserver", "default", "charcreation.xml")); REQUIRE(list[1] == pathJoin("perserver", "default", "deadmessages.xml")); REQUIRE(list[2] == pathJoin("perserver", "default", "defaultcommands.xml")); REQUIRE(list[3] == pathJoin("perserver", "default", "features.xml")); - REQUIRE(list[4] == pathJoin("perserver", "default", "weapons.xml")); + REQUIRE(list[4] == pathJoin("perserver", "default", "groups.xml")); + REQUIRE(list[5] == pathJoin("perserver", "default", "weapons.xml")); ResourceManager::deleteInstance(); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); diff --git a/src/unittests/gui/windowmanager_unittest.cc b/src/unittests/gui/windowmanager_unittest.cc index 75949fc44..1a7ff7b61 100644 --- a/src/unittests/gui/windowmanager_unittest.cc +++ b/src/unittests/gui/windowmanager_unittest.cc @@ -117,8 +117,10 @@ #include "render/sdlgraphics.h" +#include "resources/groupinfo.h" #include "resources/sdlimagehelper.h" +#include "resources/db/groupdb.h" #include "resources/db/unitsdb.h" #include "resources/item/item.h" @@ -655,10 +657,14 @@ TEST_CASE("Windows tests", "windowmanager") } SECTION("StatusWindow") { + GroupDb::GroupInfos &groups = GroupDb::getGroups(); + groups[0].name = std::string(); + groups[0].longName = std::string(); CREATEWIDGETV0(statusWindow, StatusWindow); gui->draw(); mainGraphics->updateScreen(); delete2(statusWindow); + groups.clear(); } SECTION("TextCommandEditor") { |