From b9cb3b1e94a16425025dd251955f57ca7da5f637 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 11 May 2016 21:29:26 +0300 Subject: Fix issues in tests after adding some asserts. --- data/test/CMakeLists.txt | 1 + data/test/Makefile.am | 1 + data/test/serverlistplus.xml | 171 ++++++++++++++++++++++++ src/gui/windowmanager_unittest.cc | 3 + src/resources/db/itemdb.cpp | 6 + src/resources/sprite/animatedsprite_unittest.cc | 5 +- src/utils/chatutils_unittest.cc | 29 ++++ 7 files changed, 214 insertions(+), 2 deletions(-) create mode 100644 data/test/serverlistplus.xml diff --git a/data/test/CMakeLists.txt b/data/test/CMakeLists.txt index 3336dcf8d..0cf52c800 100644 --- a/data/test/CMakeLists.txt +++ b/data/test/CMakeLists.txt @@ -1,5 +1,6 @@ SET(FILES palette.gpl + serverlistplus.xml simplefile.txt ) diff --git a/data/test/Makefile.am b/data/test/Makefile.am index 81e19612b..d019b948a 100644 --- a/data/test/Makefile.am +++ b/data/test/Makefile.am @@ -2,6 +2,7 @@ testdir = $(pkgdatadir)/data/test test_DATA = \ palette.gpl \ + serverlistplus.xml \ simplefile.txt EXTRA_DIST = \ diff --git a/data/test/serverlistplus.xml b/data/test/serverlistplus.xml new file mode 100644 index 000000000..b0c65df1f --- /dev/null +++ b/data/test/serverlistplus.xml @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + PRODUCTION + http://themanaworld.org/ + http://updates.themanaworld.org/updates + http://cdn.jsdelivr.net/themanaworld + http://forums.themanaworld.org/viewtopic.php?f=1&t=17737 + http://www.themanaworld.org/registration.php + Join adventures with people from all over the world. + Rejoignez de nouvelles aventures avec des personnes du monde entier. + Beleef avonturen met mensen van over de hele wereld. + Faça parte de aventuras com pessoas de todo o mundo. + Junte-se em aventuras com pessoas de todo o mundo. + 和来自全球的玩家一同冒险。 + Trete Abenteuern mit Spielern aus aller Welt bei. + Inizia l'avventura insieme a giocatori da tutto il mondo. + 世界中のみんなと冒険にでかけませんか? + Przeżywaj przygody z ludźmi z całego świata! + Přidejte se k dobrodružství s lidmi z celého světa. + Присоединяйся к приключениям с людьми со всего мира. + Doe moa mee met mins'n van d'n 'ele wereld. + Deel avonturen met mensen van over de hele wereld. + Bergabung berpetualangan bersama seluruh pemain dari berbagai belahan dunia. + Únete a la aventura con gente de todo el mundo. + + + + + DEVELOPMENT + + + http://download2.evolonline.org + + http://www.evolonline.org/ + http://www.evolonline.org/chat/ + Evol Online Beta server. + Serveur Beta d'Evol Online. + Evol Online Beta server. + Servidor Beta Evol Online + Servidor Beta Evol Online + Evol Online Beta 服务器。 + Evol Online Beta server. + Evol Online Beta server. + Evol Onlineβサーバー + Evol Online- serwer beta + Evol Online Beta server. + Evol Online бета сервер. + Evol Online Beta server. + Evol Online Beta Server + server Evol Online Beta. + Servidor Beta de Evol Online. + + + + + PRODUCTION + http://tmw-br.scall.org/ + http://tmw-br.scall.org/webchat + Server with original content in portuguese. + Serveur avec un contenu en portugais de base. + Server met de originele inhoud in het Portugees. + Servidor com conteúdo original em português. + Servidor com conteúdo original em português. + 葡萄牙语版服务器。 + Server mit originalem Inhalt auf Portugisisch. + Server con contenuti originali in lingua portoghese. + オリジナルな内容も充実したポルトガル語サーバー + Serwer z oryginalną zawartością w języku portugalskim + Сервер с оригинальным контентом на португальском. + Server me originel'n inhod in 't portugees. + Server met de oorspronkelijke inhoud in het Portugees. + Server dengan Bahasa Portugis + Servidor con contenido original en portugués. + + + + + DEVELOPMENT + http://germantmw.de/ + A german The Mana World Server. + Un serveur allemand du jeu The Mana World. + Een Duitse The Mana World server. + Um Servidor The Mana World alemão. + Servidor The Mana World Alemão. + 德语版 The Mana World。 + Ein deutscher The Mana World Server. + Server The Mana World in tedesco. + The Mana World ドイツ語サーバー + Niemiecki serwer The Mana World. + Německý The Mana World Server. + Немецкий сервер The Mana World. + Nen dutsn The Mana World serv'r. + Een Duitse 'The Mana World' server. + Server The Mana World dengan Bahasa German + Un Servidor de The Mana World en alemán. + + + + + Mutant clone of TMW with new quests, items, and progression speed + Clone mutant de TMW avec de nouvelles quêtes, de nouveaux objets et une progression accélérée. + Clone mutante do TMW com novas quests, itens e velocidade de progressão. + TheManaWorld游戏的克隆版本,拥有新的关卡,任务和物品等 + Zmutowany klon TMW z nowymi questami, przedmiotami i prędkością progresji. + Mutantní klon TMW s novými úkoly, předměty a rychlostí postupu. + TMW клон-мутан с новыми квестами, предметами и скоростью развития + Gemutièrde kloan van TMW me nieuw' kwestn, ding'n en voorutgoande snel'eid + Aangepaste versie van TMW met nieuwe opdrachten, voorwerpen en ontwikkelingssnelheid + Clon mutante de TMW con nuevas misiones, artículos y veloz progreso. + DEVELOPMENT + http://landoffire.org/ + + + + + DEVELOPMENT + http://manaplus.org/ + http://manaplus.org/ + http://download.evolonline.org/manaplus/hercules/data + Server for testing ManaPlus features. + + + + + DEVELOPMENT + http://themanaworld.org/ + http://forums.themanaworld.org/viewforum.php?f=2 + server.themanaworld.org/testing + http://updates.themanaworld.org/test-updates + New content can be tested here before release. + Les nouveautés peuvent être testées ici avant leur sortie officielle. + Nieuwe inhoud kan hier, alvorens te worden uitgebracht, worden getest. + Novo conteúdo pode ser testado aqui antes do lançamento. + Novos conteúdos são testados aqui antes de serem lançados. + 新内容发布前可以在这里测试。 + Neuer Inhalt kann hier vor Veröffentlichung getestet werden. + Server per testare i nuovi contenuti di gioco prima della release ufficiale. + リリース前の新しいコンテンツはこちらでテストできます + Nowa zawartość The Mana World jest testowana tutaj przed oficjalnym wydaniem. + Zde můžeš otestovat nový obsah před vydáním. + Здесь тестируется новый контент перед релизом. + Nieuw'n inhod kan ier getest weur'n voar release. + Nieuwe inhoud kan hier worden getest alvorens publiekelijk te gaan. + + Nuevos contenidos pueden ser probados aquí antes de ser liberados. + + diff --git a/src/gui/windowmanager_unittest.cc b/src/gui/windowmanager_unittest.cc index ffaa00d67..200d2178c 100644 --- a/src/gui/windowmanager_unittest.cc +++ b/src/gui/windowmanager_unittest.cc @@ -20,6 +20,7 @@ #include "catch.hpp" #include "client.h" +#include "configuration.h" #include "graphicsmanager.h" #include "settings.h" @@ -73,6 +74,7 @@ TEST_CASE("Windows tests", "windowmanager") ResourceManager::init(); resourceManager->addToSearchPath("data", Append_false); resourceManager->addToSearchPath("../data", Append_false); + branding.setValue("onlineServerFile", "test/serverlistplus.xml"); mainGraphics = new SDLGraphics; imageHelper = new SDLImageHelper; userPalette = new UserPalette; @@ -142,6 +144,7 @@ TEST_CASE("Windows tests", "windowmanager") SECTION("serversDialog") { ServerInfo mCurrentServer; + settings.configDir = PhysFs::getRealDir("test/serverlistplus.xml");; ServerDialog *serverDialog = CREATEWIDGETR(ServerDialog, &mCurrentServer, settings.configDir); diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp index 88b104db5..934974a5b 100644 --- a/src/resources/db/itemdb.cpp +++ b/src/resources/db/itemdb.cpp @@ -299,6 +299,12 @@ void ItemDB::load() void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum) { + if (fileName.empty()) + { + mLoaded = true; + return; + } + XML::Document doc(fileName, UseResman_true, SkipError_false); const XmlNodePtrConst rootNode = doc.rootNode(); diff --git a/src/resources/sprite/animatedsprite_unittest.cc b/src/resources/sprite/animatedsprite_unittest.cc index 917e53c10..f9b6e65a9 100644 --- a/src/resources/sprite/animatedsprite_unittest.cc +++ b/src/resources/sprite/animatedsprite_unittest.cc @@ -55,8 +55,8 @@ TEST_CASE("AnimatedSprite tests", "animatedsprite") ResourceManager::init(); resourceManager->addToSearchPath("data", Append_false); resourceManager->addToSearchPath("../data", Append_false); - ActorSprite::load(); - + theme = new Theme; + Theme::selectSkin(); imageHelper = new SDLImageHelper(); #ifdef USE_SDL2 SDLImageHelper::setRenderer(graphicsManager.createRenderer( @@ -65,6 +65,7 @@ TEST_CASE("AnimatedSprite tests", "animatedsprite") #else graphicsManager.createWindow(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE); #endif + ActorSprite::load(); SECTION("basic test 1") { diff --git a/src/utils/chatutils_unittest.cc b/src/utils/chatutils_unittest.cc index 74a62c811..33c4ca286 100644 --- a/src/utils/chatutils_unittest.cc +++ b/src/utils/chatutils_unittest.cc @@ -19,19 +19,47 @@ */ #include "catch.hpp" +#include "client.h" #include "actormanager.h" +#include "graphicsmanager.h" #include "party.h" #include "being/localplayer.h" +#include "gui/theme.h" + #include "utils/chatutils.h" #include "utils/delete2.h" +#include "utils/physfstools.h" + +#include "resources/resourcemanager.h" +#include "resources/sdlimagehelper.h" #include "debug.h" TEST_CASE("chatutils replaceVars") { + client = new Client; + PHYSFS_init("manaplus"); + dirSeparator = "/"; + XML::initXML(); + SDL_Init(SDL_INIT_VIDEO); + logger = new Logger(); + ResourceManager::init(); + resourceManager->addToSearchPath("data", Append_false); + resourceManager->addToSearchPath("../data", Append_false); + theme = new Theme; + Theme::selectSkin(); + imageHelper = new SDLImageHelper(); +#ifdef USE_SDL2 + SDLImageHelper::setRenderer(graphicsManager.createRenderer( + graphicsManager.createWindow(640, 480, 0, + SDL_WINDOW_SHOWN | SDL_SWSURFACE), SDL_RENDERER_SOFTWARE)); +#else + graphicsManager.createWindow(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE); +#endif + ActorSprite::load(); localPlayer = new LocalPlayer(static_cast(1), BeingTypeId_zero); actorManager = new ActorManager; @@ -198,6 +226,7 @@ TEST_CASE("chatutils replaceVars") } delete2(actorManager); + delete2(client); } TEST_CASE("chatutils textToMe") -- cgit v1.2.3-70-g09d2