summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-05-11 21:29:26 +0300
committerAndrei Karas <akaras@inbox.ru>2016-05-11 21:31:10 +0300
commitb9cb3b1e94a16425025dd251955f57ca7da5f637 (patch)
tree11ea79db51f96a2fe571e9c27aa178766a247302
parent84cdb48df045cae55356b3d6156794c9e0343f54 (diff)
downloadplus-b9cb3b1e94a16425025dd251955f57ca7da5f637.tar.gz
plus-b9cb3b1e94a16425025dd251955f57ca7da5f637.tar.bz2
plus-b9cb3b1e94a16425025dd251955f57ca7da5f637.tar.xz
plus-b9cb3b1e94a16425025dd251955f57ca7da5f637.zip
Fix issues in tests after adding some asserts.
-rw-r--r--data/test/CMakeLists.txt1
-rw-r--r--data/test/Makefile.am1
-rw-r--r--data/test/serverlistplus.xml171
-rw-r--r--src/gui/windowmanager_unittest.cc3
-rw-r--r--src/resources/db/itemdb.cpp6
-rw-r--r--src/resources/sprite/animatedsprite_unittest.cc5
-rw-r--r--src/utils/chatutils_unittest.cc29
7 files changed, 214 insertions, 2 deletions
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<serverlist version="1">
+ <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+ <its:translateRule selector="//server/description/node" translate="yes"/>
+ <its:translateRule selector="//server/state" translate="no"/>
+ <its:translateRule selector="//server/site" translate="no"/>
+ <its:translateRule selector="//server/support" translate="no"/>
+ <its:translateRule selector="//server/registerurl" translate="no"/>
+ <its:translateRule selector="//server/description_ru" translate="no"/>
+ <its:translateRule selector="//server/description_fr" translate="no"/>
+ <its:translateRule selector="//server/description_pt" translate="no"/>
+ <its:translateRule selector="//server/description_es" translate="no"/>
+ <its:translateRule selector="//server/description_ja" translate="no"/>
+ <its:translateRule selector="//server/description_de" translate="no"/>
+ <its:translateRule selector="//server/description_pl" translate="no"/>
+ <its:translateRule selector="//server/description_pt_BR" translate="no"/>
+ <its:translateRule selector="//server/description_it" translate="no"/>
+ <its:translateRule selector="//server/description_vls" translate="no"/>
+ <its:translateRule selector="//server/description_id" translate="no"/>
+ <its:translateRule selector="//server/description_zh_CN" translate="no"/>
+ <its:translateRule selector="//server/description_nl_BE" translate="no"/>
+ <its:translateRule selector="//server/description_nl" translate="no"/>
+ </its:rules>
+
+ <server name="The Mana World" type="tmwathena">
+ <connection hostname="server.themanaworld.org" althostname="167.114.185.71" port="6901" protocol="TCP" />
+ <state>PRODUCTION</state>
+ <site>http://themanaworld.org/</site>
+ <updateMirror>http://updates.themanaworld.org/updates</updateMirror>
+ <updateMirror>http://cdn.jsdelivr.net/themanaworld</updateMirror>
+ <support>http://forums.themanaworld.org/viewtopic.php?f=1&amp;t=17737</support>
+ <registerurl>http://www.themanaworld.org/registration.php</registerurl>
+ <description>Join adventures with people from all over the world.</description>
+ <description_fr>Rejoignez de nouvelles aventures avec des personnes du monde entier.</description_fr>
+ <description_nl>Beleef avonturen met mensen van over de hele wereld.</description_nl>
+ <description_pt_BR>Faça parte de aventuras com pessoas de todo o mundo.</description_pt_BR>
+ <description_pt>Junte-se em aventuras com pessoas de todo o mundo.</description_pt>
+ <description_zh_CN>和来自全球的玩家一同冒险。</description_zh_CN>
+ <description_de>Trete Abenteuern mit Spielern aus aller Welt bei.</description_de>
+ <description_it>Inizia l'avventura insieme a giocatori da tutto il mondo.</description_it>
+ <description_ja>世界中のみんなと冒険にでかけませんか?</description_ja>
+ <description_pl>Przeżywaj przygody z ludźmi z całego świata!</description_pl>
+ <description_cs>Přidejte se k dobrodružství s lidmi z celého světa.</description_cs>
+ <description_ru>Присоединяйся к приключениям с людьми со всего мира.</description_ru>
+ <description_vls>Doe moa mee met mins'n van d'n 'ele wereld.</description_vls>
+ <description_nl_BE>Deel avonturen met mensen van over de hele wereld.</description_nl_BE>
+ <description_id>Bergabung berpetualangan bersama seluruh pemain dari berbagai belahan dunia.</description_id>
+ <description_es>Únete a la aventura con gente de todo el mundo.</description_es>
+ </server>
+
+ <server name="Evol Online" type="evol2">
+ <connection hostname="world.evolonline.org" althostname="212.85.158.133" port="6901" protocol="TCP" />
+ <state>DEVELOPMENT</state>
+ <defaultUpdateHost name="Evol normal updates" />
+ <updates name="Evol beta updates">
+ <host>http://download2.evolonline.org</host>
+ </updates>
+ <site>http://www.evolonline.org/</site>
+ <support>http://www.evolonline.org/chat/</support>
+ <description>Evol Online Beta server.</description>
+ <description_fr>Serveur Beta d'Evol Online.</description_fr>
+ <description_nl> Evol Online Beta server.</description_nl>
+ <description_pt_BR>Servidor Beta Evol Online</description_pt_BR>
+ <description_pt>Servidor Beta Evol Online</description_pt>
+ <description_zh_CN>Evol Online Beta 服务器。</description_zh_CN>
+ <description_de>Evol Online Beta server.</description_de>
+ <description_it>Evol Online Beta server.</description_it>
+ <description_ja>Evol Onlineβサーバー</description_ja>
+ <description_pl>Evol Online- serwer beta </description_pl>
+ <description_cs>Evol Online Beta server.</description_cs>
+ <description_ru>Evol Online бета сервер.</description_ru>
+ <description_vls>Evol Online Beta server.</description_vls>
+ <description_nl_BE>Evol Online Beta Server</description_nl_BE>
+ <description_id>server Evol Online Beta.</description_id>
+ <description_es>Servidor Beta de Evol Online.</description_es>
+ </server>
+
+ <server name="The Mana World (Brazil)" type="tmwathena">
+ <connection hostname="tmw-br.scall.org" port="6901" protocol="TCP" />
+ <state>PRODUCTION</state>
+ <site>http://tmw-br.scall.org/</site>
+ <support>http://tmw-br.scall.org/webchat</support>
+ <description>Server with original content in portuguese.</description>
+ <description_fr>Serveur avec un contenu en portugais de base.</description_fr>
+ <description_nl>Server met de originele inhoud in het Portugees.</description_nl>
+ <description_pt_BR>Servidor com conteúdo original em português.</description_pt_BR>
+ <description_pt>Servidor com conteúdo original em português.</description_pt>
+ <description_zh_CN>葡萄牙语版服务器。</description_zh_CN>
+ <description_de>Server mit originalem Inhalt auf Portugisisch.</description_de>
+ <description_it>Server con contenuti originali in lingua portoghese.</description_it>
+ <description_ja>オリジナルな内容も充実したポルトガル語サーバー</description_ja>
+ <description_pl>Serwer z oryginalną zawartością w języku portugalskim</description_pl>
+ <description_ru>Сервер с оригинальным контентом на португальском.</description_ru>
+ <description_vls>Server me originel'n inhod in 't portugees.</description_vls>
+ <description_nl_BE>Server met de oorspronkelijke inhoud in het Portugees.</description_nl_BE>
+ <description_id>Server dengan Bahasa Portugis</description_id>
+ <description_es>Servidor con contenido original en portugués.</description_es>
+ </server>
+
+ <server name="The Mana World (German)" type="tmwathena">
+ <connection hostname="germantmw.de" port="6901" protocol="TCP" />
+ <state>DEVELOPMENT</state>
+ <site>http://germantmw.de/</site>
+ <description>A german The Mana World Server.</description>
+ <description_fr>Un serveur allemand du jeu The Mana World.</description_fr>
+ <description_nl>Een Duitse The Mana World server.</description_nl>
+ <description_pt_BR>Um Servidor The Mana World alemão.</description_pt_BR>
+ <description_pt>Servidor The Mana World Alemão.</description_pt>
+ <description_zh_CN>德语版 The Mana World。</description_zh_CN>
+ <description_de>Ein deutscher The Mana World Server.</description_de>
+ <description_it>Server The Mana World in tedesco.</description_it>
+ <description_ja>The Mana World ドイツ語サーバー</description_ja>
+ <description_pl>Niemiecki serwer The Mana World.</description_pl>
+ <description_cs>Německý The Mana World Server.</description_cs>
+ <description_ru>Немецкий сервер The Mana World.</description_ru>
+ <description_vls>Nen dutsn The Mana World serv'r.</description_vls>
+ <description_nl_BE>Een Duitse 'The Mana World' server.</description_nl_BE>
+ <description_id>Server The Mana World dengan Bahasa German</description_id>
+ <description_es>Un Servidor de The Mana World en alemán.</description_es>
+ </server>
+
+ <server name="Land of Fire" type="tmwathena">
+ <connection hostname="landoffire.org" port="6901" protocol="TCP" />
+ <description>Mutant clone of TMW with new quests, items, and progression speed</description>
+ <description_fr>Clone mutant de TMW avec de nouvelles quêtes, de nouveaux objets et une progression accélérée.</description_fr>
+ <description_pt_BR>Clone mutante do TMW com novas quests, itens e velocidade de progressão.</description_pt_BR>
+ <description_zh_CN>TheManaWorld游戏的克隆版本,拥有新的关卡,任务和物品等</description_zh_CN>
+ <description_pl>Zmutowany klon TMW z nowymi questami, przedmiotami i prędkością progresji.</description_pl>
+ <description_cs>Mutantní klon TMW s novými úkoly, předměty a rychlostí postupu.</description_cs>
+ <description_ru>TMW клон-мутан с новыми квестами, предметами и скоростью развития</description_ru>
+ <description_vls>Gemutièrde kloan van TMW me nieuw' kwestn, ding'n en voorutgoande snel'eid</description_vls>
+ <description_nl_BE>Aangepaste versie van TMW met nieuwe opdrachten, voorwerpen en ontwikkelingssnelheid</description_nl_BE>
+ <description_es>Clon mutante de TMW con nuevas misiones, artículos y veloz progreso.</description_es>
+ <state>DEVELOPMENT</state>
+ <site>http://landoffire.org/</site>
+ </server>
+
+ <server name="Hercules preview server" type="eathena">
+ <connection hostname="hercules.manaplus.org" althostname="212.85.158.133" port="6900" protocol="TCP" packetVersion="20150000"/>
+ <state>DEVELOPMENT</state>
+ <site>http://manaplus.org/</site>
+ <support>http://manaplus.org/</support>
+ <updateMirror>http://download.evolonline.org/manaplus/hercules/data</updateMirror>
+ <description>Server for testing ManaPlus features.</description>
+ </server>
+
+ <server name="The Mana World test server" type="tmwathena">
+ <connection hostname="testing.themanaworld.org" althostname="167.114.185.71" port="6902" protocol="TCP" />
+ <state>DEVELOPMENT</state>
+ <site>http://themanaworld.org/</site>
+ <support>http://forums.themanaworld.org/viewforum.php?f=2</support>
+ <onlineListUrl>server.themanaworld.org/testing</onlineListUrl>
+ <updateMirror>http://updates.themanaworld.org/test-updates</updateMirror>
+ <description>New content can be tested here before release.</description>
+ <description_fr>Les nouveautés peuvent être testées ici avant leur sortie officielle.</description_fr>
+ <description_nl>Nieuwe inhoud kan hier, alvorens te worden uitgebracht, worden getest.</description_nl>
+ <description_pt_BR>Novo conteúdo pode ser testado aqui antes do lançamento.</description_pt_BR>
+ <description_pt>Novos conteúdos são testados aqui antes de serem lançados. </description_pt>
+ <description_zh_CN>新内容发布前可以在这里测试。</description_zh_CN>
+ <description_de>Neuer Inhalt kann hier vor Veröffentlichung getestet werden.</description_de>
+ <description_it>Server per testare i nuovi contenuti di gioco prima della release ufficiale.</description_it>
+ <description_ja>リリース前の新しいコンテンツはこちらでテストできます</description_ja>
+ <description_pl>Nowa zawartość The Mana World jest testowana tutaj przed oficjalnym wydaniem.</description_pl>
+ <description_cs>Zde můžeš otestovat nový obsah před vydáním.</description_cs>
+ <description_ru>Здесь тестируется новый контент перед релизом.</description_ru>
+ <description_vls>Nieuw'n inhod kan ier getest weur'n voar release.</description_vls>
+ <description_nl_BE>Nieuwe inhoud kan hier worden getest alvorens publiekelijk te gaan.</description_nl_BE>
+ <description_id> </description_id>
+ <description_es>Nuevos contenidos pueden ser probados aquí antes de ser liberados.</description_es>
+ </server>
+</serverlist>
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<BeingId>(1),
BeingTypeId_zero);
actorManager = new ActorManager;
@@ -198,6 +226,7 @@ TEST_CASE("chatutils replaceVars")
}
delete2(actorManager);
+ delete2(client);
}
TEST_CASE("chatutils textToMe")