summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-08-02 03:15:18 +0300
committerAndrei Karas <akaras@inbox.ru>2016-08-02 03:15:18 +0300
commitd0d872ffeff89facdd35ce358bd4d9b73cf8332c (patch)
tree806e6d7b2c70a05de9b473505d0269945843e574
parent950c3109bcd8a69d77d22c316cfc6ab34abf5f22 (diff)
downloadmanaplus-d0d872ffeff89facdd35ce358bd4d9b73cf8332c.tar.gz
manaplus-d0d872ffeff89facdd35ce358bd4d9b73cf8332c.tar.bz2
manaplus-d0d872ffeff89facdd35ce358bd4d9b73cf8332c.tar.xz
manaplus-d0d872ffeff89facdd35ce358bd4d9b73cf8332c.zip
Add all known windows into windows unit tests.
-rw-r--r--data/test/CMakeLists.txt6
-rw-r--r--data/test/Makefile.am8
-rw-r--r--data/test/dye.pngbin0 -> 794 bytes
-rw-r--r--data/test/equipmentwindow.xml53
-rw-r--r--data/test/items.xml187
-rw-r--r--data/test/paths.xml7
-rw-r--r--data/test/units.xml10
-rw-r--r--src/gui/windowmanager_unittest.cc435
-rw-r--r--src/gui/windows/itemamountwindow.h2
-rw-r--r--src/gui/windows/ministatuswindow.cpp3
10 files changed, 675 insertions, 36 deletions
diff --git a/data/test/CMakeLists.txt b/data/test/CMakeLists.txt
index 1c98ea1d6..e300301d8 100644
--- a/data/test/CMakeLists.txt
+++ b/data/test/CMakeLists.txt
@@ -3,9 +3,15 @@ SET(FILES
arrow_up_A.png
arrow_up_B.png
arrow_up_S.png
+ dye.png
+ equipmentwindow.xml
+ items.xml
palette.gpl
+ paths.xml
+ quests.xml
serverlistplus.xml
simplefile.txt
+ units.xml
)
INSTALL(FILES ${FILES} DESTINATION ${DATA_DIR}/test)
diff --git a/data/test/Makefile.am b/data/test/Makefile.am
index 1f17ebca2..5000dbadb 100644
--- a/data/test/Makefile.am
+++ b/data/test/Makefile.am
@@ -5,9 +5,15 @@ test_DATA = \
arrow_up_A.png \
arrow_up_B.png \
arrow_up_S.png \
+ dye.png \
+ equipmentwindow.xml \
+ items.xml \
palette.gpl \
+ paths.xml \
+ quests.xml \
serverlistplus.xml \
- simplefile.txt
+ simplefile.txt \
+ units.xml
EXTRA_DIST = \
$(test_DATA) \
diff --git a/data/test/dye.png b/data/test/dye.png
new file mode 100644
index 000000000..a78675b94
--- /dev/null
+++ b/data/test/dye.png
Binary files differ
diff --git a/data/test/equipmentwindow.xml b/data/test/equipmentwindow.xml
new file mode 100644
index 000000000..91db49205
--- /dev/null
+++ b/data/test/equipmentwindow.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Author: 4144
+Copyright (C) 2011-2012 Evol Online -->
+
+<equipment>
+ <page name="default">
+ <playerbox x="50" y="80" width="74" height="168"/>
+ <slot name="torso" x="94" y="48" image="0"/>
+ <slot name="gloves" x="8" y="92" image="1"/>
+ <slot name="hat" x="72" y="4" image="2"/>
+ <slot name="pants" x="50" y="271" image="3"/>
+ <slot name="boots" x="94" y="271" image="4"/>
+ <slot name="" x="8" y="213"/>
+ <slot name="wings" x="136" y="227" image="10"/>
+ <slot name="scarf" x="50" y="48" image="11"/>
+ <slot name="weapon" x="8" y="182" image="7"/>
+ <slot name="shield" x="136" y="182" image="8"/>
+ <slot name="ammo" x="136" y="92" image="9"/>
+ <slot name="amulet" x="8" y="137" image="6"/>
+ <slot name="ring" x="136" y="137" image="5"/>
+ </page>
+ <page name="all">
+ <slot name="slot0" x="8" y="0" image="0"/>
+ <slot name="slot1" x="48" y="0" image="0"/>
+ <slot name="slot2" x="88" y="0" image="0"/>
+ <slot name="slot3" x="128" y="0" image="0"/>
+
+ <slot name="slot4" x="8" y="40" image="0"/>
+ <slot name="slot5" x="48" y="40" image="0"/>
+ <slot name="slot6" x="88" y="40" image="0"/>
+ <slot name="slot7" x="128" y="40" image="0"/>
+
+ <slot name="slot8" x="8" y="80" image="0"/>
+ <slot name="slot9" x="48" y="80" image="0"/>
+ <slot name="slot10" x="88" y="80" image="0"/>
+ <slot name="slot11" x="128" y="80" image="0"/>
+
+ <slot name="slot12" x="8" y="120" image="0"/>
+ <slot name="slot13" x="48" y="120" image="0"/>
+ <slot name="slot14" x="88" y="120" image="0"/>
+ <slot name="slot15" x="128" y="120" image="0"/>
+
+ <slot name="slot16" x="8" y="160" image="0"/>
+ <slot name="slot17" x="48" y="160" image="0"/>
+ <slot name="slot18" x="88" y="160" image="0"/>
+ <slot name="slot19" x="128" y="160" image="0"/>
+
+ <slot name="slot20" x="8" y="200" image="0"/>
+ <slot name="slot21" x="48" y="200" image="0"/>
+ <slot name="slot22" x="88" y="200" image="0"/>
+ <slot name="slot23" x="128" y="200" image="0"/>
+ </page>
+</equipment>
diff --git a/data/test/items.xml b/data/test/items.xml
new file mode 100644
index 000000000..ec3621f23
--- /dev/null
+++ b/data/test/items.xml
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="utf-8"?>
+<?xml-stylesheet type="text/xsl" href="items.xsl"?>
+<!-- Authors: 4144, Alige, Piman, Reid
+Copyright (C) 2010-2015 Evol Online -->
+
+<!--
+New organization (04/12/11).
+-0 -99 = Hairstyles
+-100 -infinity = Races
+30 500 = Weapon Animations
+501 699 = Usable Items
+700 999 = Generic Items
+1000 1299 = Necklaces
+1300 1799 = Chest Armors
+1800 1999 = Boots
+2000 2199 = Gloves
+2200 2499 = Pants
+2500 2699 = Wings
+2700 2899 = Shields
+2900 3199 = Head Gears
+3200 3499 = Neck Armors
+3500 3999 = Weapons
+4000 4999 = Pets
+5000 5999 = Cards
+6000 6999 = Bows
+7000 7999 = Arrows
+Colors for dyeable equipments or items are now set up by itemcolors.xml.
+-->
+
+<items>
+ <!-- Hairstyles -->
+ <item id="-1" type="hairsprite" name="Bald">
+ <sprite>hairstyles/hairstyle01.xml</sprite>
+ </item>
+ <item id="-2" type="hairsprite" name="Bowl Cut" colors="hairS">
+ <sprite>hairstyles/hairstyle02.xml</sprite>
+ </item>
+ <item id="-3" type="hairsprite" name="Combed Back" colors="hairS">
+ <sprite>hairstyles/hairstyle03.xml</sprite>
+ </item>
+ <item id="-4" type="hairsprite" name="Emo" colors="hairS">
+ <sprite>hairstyles/hairstyle04.xml</sprite>
+ </item>
+ <item id="-5" type="hairsprite" name="Mohawk" colors="hairS">
+ <sprite>hairstyles/hairstyle05.xml</sprite>
+ </item>
+ <item id="-6" type="hairsprite" name="Pompadour" colors="hairS">
+ <sprite>hairstyles/hairstyle06.xml</sprite>
+ </item>
+ <item id="-7" type="hairsprite" name="Center Parting" colors="hairS">
+ <sprite>hairstyles/hairstyle07.xml</sprite>
+ </item>
+ <item id="-8" type="hairsprite" name="Long and Slick" colors="hair">
+ <sprite>hairstyles/hairstyle08.xml</sprite>
+ </item>
+ <item id="-9" type="hairsprite" name="Short and Curly" colors="hair">
+ <sprite>hairstyles/hairstyle09.xml</sprite>
+ </item>
+ <item id="-10" type="hairsprite" name="Pigtails" colors="hair">
+ <sprite>hairstyles/hairstyle10.xml</sprite>
+ </item>
+ <item id="-11" type="hairsprite" name="Long and Curly" colors="hair">
+ <sprite>hairstyles/hairstyle11.xml</sprite>
+ </item>
+ <item id="-12" type="hairsprite" name="Parted" colors="hair">
+ <sprite>hairstyles/hairstyle12.xml</sprite>
+ </item>
+ <item id="-13" type="hairsprite" name="Perky Ponytail" colors="hairS">
+ <sprite>hairstyles/hairstyle13.xml</sprite>
+ </item>
+ <item id="-14" type="hairsprite" name="Wave" colors="hairS">
+ <sprite>hairstyles/hairstyle14.xml</sprite>
+ </item>
+ <item id="-15" type="hairsprite" name="Mane" colors="hairS">
+ <sprite>hairstyles/hairstyle15.xml</sprite>
+ </item>
+ <item id="-16" type="hairsprite" name="Bun" colors="hairS">
+ <sprite>hairstyles/hairstyle16.xml</sprite>
+ </item>
+ <item id="-17" type="hairsprite" name="Wavy" colors="hairS">
+ <sprite>hairstyles/hairstyle17.xml</sprite>
+ </item>
+ <item id="-18" type="hairsprite" name="Bunches" colors="hairS">
+ <sprite>hairstyles/hairstyle18.xml</sprite>
+ </item>
+ <item id="-19" type="hairsprite" name="Long Ponytail" colors="hairS">
+ <sprite>hairstyles/hairstyle19.xml</sprite>
+ </item>
+ <item id="-20" type="hairsprite" name="Infinitely Long" colors="hair">
+ <sprite>hairstyles/hairstyle20.xml</sprite>
+ </item>
+ <item id="-21" type="hairsprite" name="Choppy" colors="hair">
+ <sprite>hairstyles/hairstyle21.xml</sprite>
+ </item>
+ <item id="-22" type="hairsprite" name="Wild" colors="hair">
+ <sprite>hairstyles/hairstyle22.xml</sprite>
+ </item>
+ <item id="-23" type="hairsprite" name="Punk" colors="hairS">
+ <sprite>hairstyles/hairstyle23.xml</sprite>
+ </item>
+ <item id="-24" type="hairsprite" name="Imperial" colors="hairS">
+ <sprite>hairstyles/hairstyle24.xml</sprite>
+ </item>
+ <item id="-25" type="hairsprite" name="Side Strand" colors="hairS">
+ <sprite>hairstyles/hairstyle25.xml</sprite>
+ </item>
+ <item id="-26" type="hairsprite" name="Messy" colors="hairS">
+ <sprite>hairstyles/hairstyle26.xml</sprite>
+ </item>
+ <item id="-27" type="hairsprite" name="Flat Ponytail" colors="hairS">
+ <sprite>hairstyles/hairstyle27.xml</sprite>
+ </item>
+ <item id="-28" type="hairsprite" name="Tapered Nape" colors="hairS">
+ <sprite>hairstyles/hairstyle28.xml</sprite>
+ </item>
+
+ <!-- Races -->
+ <item id="-100" type="racesprite" name="Human">
+ <sprite gender="unisex">races/human-male.xml</sprite>
+ <sprite gender="female">races/human-female.xml</sprite>
+ <sound event="hit">weapons/barehands/hit1.ogg</sound>
+ <sound event="miss">weapons/barehands/miss1.ogg</sound>
+ </item>
+ <item id="-101" type="racesprite" name="Ukar">
+ <sprite gender="unisex">races/ukar-male.xml</sprite>
+ <sprite gender="female">races/ukar-female.xml</sprite>
+ <sound event="hit">weapons/barehands/hit1.ogg</sound>
+ <sound event="miss">weapons/barehands/miss1.ogg</sound>
+ </item>
+ <item id="-102" type="racesprite" name="Demon">
+ <sprite gender="unisex">races/demon-male.xml</sprite>
+ <sprite gender="female">races/demon-female.xml</sprite>
+ <sound event="hit">weapons/barehands/hit1.ogg</sound>
+ <sound event="miss">weapons/barehands/miss1.ogg</sound>
+ </item>
+ <item id="-103" type="racesprite" name="Elven">
+ <sprite gender="unisex">races/elven-male.xml</sprite>
+ <sprite gender="female">races/elven-female.xml</sprite>
+ <sound event="hit">weapons/barehands/hit1.ogg</sound>
+ <sound event="miss">weapons/barehands/miss1.ogg</sound>
+ </item>
+ <item id="-104" type="racesprite" name="Orc">
+ <sprite gender="unisex">races/orc-male.xml</sprite>
+ <sprite gender="female">races/orc-female.xml</sprite>
+ <sound event="hit">weapons/barehands/hit1.ogg</sound>
+ <sound event="miss">weapons/barehands/miss1.ogg</sound>
+ </item>
+ <item id="-105" type="racesprite" name="Raijin">
+ <sprite gender="unisex">races/raijin-male.xml</sprite>
+ <sprite gender="female">races/raijin-female.xml</sprite>
+ <sound event="hit">weapons/barehands/hit1.ogg</sound>
+ <sound event="miss">weapons/barehands/miss1.ogg</sound>
+ </item>
+ <item id="-106" type="racesprite" name="Tritan">
+ <sprite gender="unisex">races/tritan-male.xml</sprite>
+ <sprite gender="female">races/tritan-female.xml</sprite>
+ <sound event="hit">weapons/barehands/hit1.ogg</sound>
+ <sound event="miss">weapons/barehands/miss1.ogg</sound>
+ </item>
+
+ <!-- Special Races -->
+ <item id="-150" type="racesprite" name="Piou">
+ <sprite gender="unisex">races/piou-unisex.xml</sprite>
+ <sound event="hit">monsters/piou/hit1.ogg</sound>
+ <sound event="miss">monsters/piou/miss1.ogg</sound>
+ </item>
+
+ <!-- Cards -->
+ <item id="5000"
+ image="dye.png|S:#3c3c3c,3e1e28,4d4d4d,6f2630,686868,a6313f,919191,d15b5b,b6b6b6,e59b77,dfdfdf,efe0c1"
+ name="Crimson Cashmere Dye"
+ useButton="Dye"
+ description="Color dye that can be used on cashemere clothing."
+ type="card"
+ weight="1"
+ cardColor="2"
+ maxFloorOffset="15"/>
+ <item id="5001"
+ image="dye.png|S:#3c3c3c,302525,4d4d4d,4a3430,686868,69453a,919191,96664c,b6b6b6,bf8d67,dfdfdf,e6c19c"
+ name="Chocolate Cashmere Dye"
+ useButton="Dye"
+ description="Color dye that can be used on cashemere clothing."
+ type="card"
+ weight="1"
+ cardColor="3"
+ maxFloorOffset="15"/>
+</items>
diff --git a/data/test/paths.xml b/data/test/paths.xml
new file mode 100644
index 000000000..ce2433212
--- /dev/null
+++ b/data/test/paths.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Authors: 4144, Alige, Reid
+Copyright (C) 2010-2013 Evol Online -->
+
+<configuration>
+ <option name="itemIcons" value=""/>
+</configuration>
diff --git a/data/test/units.xml b/data/test/units.xml
new file mode 100644
index 000000000..37e520127
--- /dev/null
+++ b/data/test/units.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Author: 4144
+Copyright (C) 2010-2013 Evol Online -->
+
+<units>
+ <unit type="currency" base=" E" round="0" separator=" "/>
+ <unit type="weight" base=" Florin" round="0" separator=" ">
+ <level symbol=" KF" count="1000" round="2"/>
+ </unit>
+</units>
diff --git a/src/gui/windowmanager_unittest.cc b/src/gui/windowmanager_unittest.cc
index ccd027f98..567e0c96e 100644
--- a/src/gui/windowmanager_unittest.cc
+++ b/src/gui/windowmanager_unittest.cc
@@ -23,10 +23,13 @@
#include "configuration.h"
#include "graphicsmanager.h"
#include "settings.h"
+#include "units.h"
+#include "textcommand.h"
-#include "being/actorsprite.h"
+#include "being/being.h"
#include "gui/gui.h"
+#include "gui/mailmessage.h"
#include "gui/userpalette.h"
#include "gui/popups/beingpopup.h"
@@ -40,19 +43,72 @@
#include "gui/widgets/createwidget.h"
#include "gui/widgets/windowcontainer.h"
+#include "gui/windows/bankwindow.h"
+#include "gui/windows/buydialog.h"
+#include "gui/windows/buyingstoreselldialog.h"
+#include "gui/windows/buyselldialog.h"
+#include "gui/windows/changeemaildialog.h"
+#include "gui/windows/changepassworddialog.h"
+#include "gui/windows/chatwindow.h"
#include "gui/windows/connectiondialog.h"
+#include "gui/windows/confirmdialog.h"
+#include "gui/windows/cutinwindow.h"
+#include "gui/windows/debugwindow.h"
#include "gui/windows/didyouknowwindow.h"
+#include "gui/windows/editdialog.h"
+#include "gui/windows/editserverdialog.h"
+#include "gui/windows/eggselectiondialog.h"
+#include "gui/windows/emotewindow.h"
+#include "gui/windows/equipmentwindow.h"
#include "gui/windows/helpwindow.h"
+#include "gui/windows/insertcarddialog.h"
+#include "gui/windows/inventorywindow.h"
+#include "gui/windows/itemamountwindow.h"
+#include "gui/windows/killstats.h"
#include "gui/windows/logindialog.h"
-#include "gui/windows/setupwindow.h"
+#include "gui/windows/maileditwindow.h"
+#include "gui/windows/mailviewwindow.h"
+#include "gui/windows/mailwindow.h"
+#include "gui/windows/minimap.h"
+#include "gui/windows/ministatuswindow.h"
+#include "gui/windows/npcdialog.h"
+#include "gui/windows/npcselldialog.h"
+#include "gui/windows/okdialog.h"
+#include "gui/windows/outfitwindow.h"
+#include "gui/windows/questswindow.h"
+#include "gui/windows/quitdialog.h"
+#include "gui/windows/registerdialog.h"
#include "gui/windows/serverdialog.h"
+#include "gui/windows/setupwindow.h"
+#include "gui/windows/shopwindow.h"
+#include "gui/windows/shortcutwindow.h"
+#include "gui/windows/skilldialog.h"
+#include "gui/windows/socialwindow.h"
+#include "gui/windows/statuswindow.h"
+#include "gui/windows/textcommandeditor.h"
+#include "gui/windows/textdialog.h"
+#include "gui/windows/textselectdialog.h"
+#include "gui/windows/tradewindow.h"
+#include "gui/windows/updaterwindow.h"
+#include "gui/windows/whoisonline.h"
+#include "gui/windows/worldselectdialog.h"
#include "input/touch/touchmanager.h"
+#include "net/logindata.h"
+
+#include "net/eathena/inventoryhandler.h"
+#include "net/eathena/serverfeatures.h"
+#include "net/eathena/playerhandler.h"
+
#include "render/sdlgraphics.h"
#include "resources/sdlimagehelper.h"
+#include "resources/item/item.h"
+
+#include "resources/map/map.h"
+
#include "resources/resourcemanager/resourcemanager.h"
#include "utils/delete2.h"
@@ -60,8 +116,12 @@
#include "utils/gettext.h"
#include "utils/physfstools.h"
+#include "utils/translation/translationmanager.h"
+
#include "debug.h"
+extern QuitDialog *quitDialog;
+
TEST_CASE("Windows tests", "windowmanager")
{
setEnv("SDL_VIDEODRIVER", "dummy");
@@ -84,24 +144,355 @@ TEST_CASE("Windows tests", "windowmanager")
gui = new Gui();
gui->postInit(mainGraphics);
touchManager.init();
+ Units::loadUnits();
+ serverFeatures = new EAthena::ServerFeatures;
+ inventoryHandler = new EAthena::InventoryHandler;
+ playerHandler = new EAthena::PlayerHandler;
+ paths.setValue("itemIcons", "");
+ TranslationManager::init();
mainGraphics->setVideoMode(640, 480, 1, 8, false, false, false, false);
- SECTION("setupWindow")
+ SECTION("bankWindow")
{
- CREATEWIDGETV0(setupWindow, SetupWindow);
- delete2(setupWindow);
+ CREATEWIDGETV0(bankWindow, BankWindow);
+ delete2(bankWindow);
}
- SECTION("helpWindow")
+ SECTION("buyDialog")
{
- CREATEWIDGETV0(helpWindow, HelpWindow);
- delete2(helpWindow);
+ BuyDialog *dialog;
+ CREATEWIDGETV(dialog, BuyDialog, BeingId_zero);
+ delete2(dialog);
+ }
+ SECTION("BuyingStoreSellDialog")
+ {
+ BuyingStoreSellDialog *dialog;
+ CREATEWIDGETV(dialog, BuyingStoreSellDialog,
+ BeingId_zero, 0);
+ delete2(dialog);
+ }
+ SECTION("BuySellDialog")
+ {
+ BuySellDialog *dialog;
+ CREATEWIDGETV(dialog, BuySellDialog, BeingId_zero);
+ delete2(dialog);
+ }
+ SECTION("ChangeEmailDialog")
+ {
+ LoginData data;
+ ChangeEmailDialog *dialog;
+ CREATEWIDGETV(dialog, ChangeEmailDialog, data);
+ delete2(dialog);
+ }
+ SECTION("ChangePasswordDialog")
+ {
+ LoginData data;
+ ChangePasswordDialog *dialog;
+ CREATEWIDGETV(dialog, ChangePasswordDialog, data);
+ delete2(dialog);
+ }
+/*
+ SECTION("CharSelectDialog")
+ {
+ LoginData data;
+ CharSelectDialog *dialog;
+ CREATEWIDGETV(dialog, CharSelectDialog, data);
+ }
+ SECTION("CharCreateDialog")
+ {
+ LoginData data;
+ CharSelectDialog *dialog2;
+ CREATEWIDGETV(dialog2, CharSelectDialog, data);
+ CharCreateDialog *dialog;
+ CREATEWIDGETV(dialog, CharCreateDialog, dialog2, 0);
+ delete2(dialog);
+ delete2(dialog2);
+ }
+*/
+ SECTION("ChatWindow")
+ {
+ CREATEWIDGETV0(chatWindow, ChatWindow);
+ delete2(chatWindow);
+ }
+ SECTION("ConfirmDialog")
+ {
+ ConfirmDialog *dialog;
+ CREATEWIDGETV(dialog, ConfirmDialog,
+ "", "", "", false, Modal_false, nullptr);
+ delete2(dialog);
+ }
+ SECTION("CutinWindow")
+ {
+ CREATEWIDGETV0(cutInWindow, CutInWindow);
+ delete2(cutInWindow);
+ }
+ SECTION("DebugWindow")
+ {
+ CREATEWIDGETV0(debugWindow, DebugWindow);
+ delete2(debugWindow);
}
SECTION("didYouKnowWindow")
{
CREATEWIDGETV0(didYouKnowWindow, DidYouKnowWindow);
delete2(didYouKnowWindow);
}
+ SECTION("EditDialog")
+ {
+ EditDialog *dialog;
+ CREATEWIDGETV(dialog, EditDialog,
+ "", "", "", 100, nullptr, Modal_false);
+ delete2(dialog);
+ }
+ SECTION("EditServerDialog")
+ {
+ ServerInfo mCurrentServer;
+ settings.configDir = PhysFs::getRealDir("test/serverlistplus.xml");
+ ServerDialog *serverDialog = CREATEWIDGETR(ServerDialog,
+ &mCurrentServer,
+ settings.configDir);
+ EditServerDialog *editServerDialog = CREATEWIDGETR(EditServerDialog,
+ serverDialog, mCurrentServer, 0);
+ delete2(editServerDialog);
+ delete2(serverDialog);
+ }
+ SECTION("EggSelectionDialog")
+ {
+ EggSelectionDialog *dialog = CREATEWIDGETR0(EggSelectionDialog);
+ delete2(dialog);
+ }
+ SECTION("EmoteWindow")
+ {
+ EmoteWindow *dialog = CREATEWIDGETR0(EmoteWindow);
+ delete2(dialog);
+ }
+ SECTION("EquipmentWindow")
+ {
+ Equipment *equipment = new Equipment;
+ Map *map = new Map("test", 100, 100, 32, 32);
+ Being *being = new Being(BeingId_zero,
+ ActorType::Player,
+ BeingTypeId_zero,
+ map);
+ EquipmentWindow *dialog = CREATEWIDGETR(EquipmentWindow,
+ equipment, being, false);
+ delete2(dialog);
+ delete2(being);
+ delete2(map);
+ delete2(equipment);
+ }
+ SECTION("helpWindow")
+ {
+ CREATEWIDGETV0(helpWindow, HelpWindow);
+ delete2(helpWindow);
+ }
+ SECTION("InsertCardDialog")
+ {
+ Item *item = new Item(5000,
+ ItemType::Card,
+ 1,
+ 0,
+ ItemColor_one,
+ Identified_true,
+ Damaged_false,
+ Favorite_false,
+ Equipm_true,
+ Equipped_false);
+ InsertCardDialog *dialog = CREATEWIDGETR(InsertCardDialog,
+ 0, item);
+ delete2(dialog);
+ delete2(item);
+ }
+ SECTION("InventoryWindow")
+ {
+ Inventory *inventory = new Inventory(InventoryType::Inventory);
+ InventoryWindow *dialog = CREATEWIDGETR(InventoryWindow,
+ inventory);
+ delete2(dialog);
+ delete2(inventory);
+ }
+ SECTION("ItemAmountWindow")
+ {
+ Item *item = new Item(5000,
+ ItemType::Card,
+ 1,
+ 0,
+ ItemColor_one,
+ Identified_true,
+ Damaged_false,
+ Favorite_false,
+ Equipm_true,
+ Equipped_false);
+ ItemAmountWindow *dialog = CREATEWIDGETR(ItemAmountWindow,
+ ItemAmountWindowUsage::ItemDrop, nullptr, item);
+ delete2(dialog);
+ delete2(item);
+ }
+ SECTION("KillStats")
+ {
+ CREATEWIDGETV0(killStats, KillStats);
+ delete2(killStats);
+ }
+ SECTION("loginDialog")
+ {
+ ServerInfo mCurrentServer;
+ LoginDialog *loginDialog = CREATEWIDGETR(LoginDialog,
+ loginData,
+ &mCurrentServer,
+ &settings.options.updateHost);
+ delete2(loginDialog);
+ }
+ SECTION("MailEditWindow")
+ {
+ CREATEWIDGETV0(mailEditWindow, MailEditWindow);
+ delete2(mailEditWindow);
+ }
+ SECTION("MailViewWindow")
+ {
+ MailMessage *message = new MailMessage;
+ CREATEWIDGETV(mailViewWindow, MailViewWindow,
+ message);
+ delete2(mailViewWindow);
+ }
+ SECTION("MailWindow")
+ {
+ CREATEWIDGETV0(mailWindow, MailWindow);
+ delete2(mailWindow);
+ }
+ SECTION("Minimap")
+ {
+ CREATEWIDGETV0(minimap, Minimap);
+ delete2(minimap);
+ }
+ SECTION("MiniStatusWindow")
+ {
+ CREATEWIDGETV0(miniStatusWindow, MiniStatusWindow);
+ delete2(miniStatusWindow);
+ }
+ SECTION("NpcDialog")
+ {
+ NpcDialog *dialog = CREATEWIDGETR(NpcDialog, BeingId_zero);
+ delete2(dialog);
+ }
+ SECTION("NpcSellDialog")
+ {
+ NpcSellDialog *dialog = CREATEWIDGETR(NpcSellDialog, BeingId_zero);
+ delete2(dialog);
+ }
+ SECTION("OkDialog")
+ {
+ OkDialog *dialog = CREATEWIDGETR(OkDialog,
+ "", "", "", DialogType::SILENCE, Modal_false,
+ ShowCenter_true, nullptr, 100);
+ delete2(dialog);
+ }
+ SECTION("OutfitWindow")
+ {
+ CREATEWIDGETV0(outfitWindow, OutfitWindow);
+ delete2(outfitWindow);
+ }
+ SECTION("QuestsWindow")
+ {
+ CREATEWIDGETV0(questsWindow, QuestsWindow);
+ delete2(questsWindow);
+ }
+ SECTION("QuitDialog")
+ {
+ CREATEWIDGETV(quitDialog, QuitDialog,
+ &quitDialog);
+ delete2(quitDialog);
+ }
+ SECTION("RegisterDialog")
+ {
+ RegisterDialog *dialog = CREATEWIDGETR(RegisterDialog,
+ loginData);
+ delete2(dialog);
+ }
+ SECTION("serversDialog")
+ {
+ ServerInfo mCurrentServer;
+ settings.configDir = PhysFs::getRealDir("test/serverlistplus.xml");
+ ServerDialog *serverDialog = CREATEWIDGETR(ServerDialog,
+ &mCurrentServer,
+ settings.configDir);
+ delete2(serverDialog);
+ }
+ SECTION("setupWindow")
+ {
+ CREATEWIDGETV0(setupWindow, SetupWindow);
+ delete2(setupWindow);
+ }
+ SECTION("ShopSellDialog")
+ {
+ // only tmwa skipping
+ }
+ SECTION("ShopWindow")
+ {
+ CREATEWIDGETV0(shopWindow, ShopWindow);
+ delete2(shopWindow);
+ }
+ SECTION("ShortcutWindow")
+ {
+ CREATEWIDGETV(itemShortcutWindow, ShortcutWindow, "");
+ delete2(itemShortcutWindow);
+ }
+ SECTION("SkillDialog")
+ {
+ CREATEWIDGETV0(skillDialog, SkillDialog);
+ delete2(skillDialog);
+ }
+ SECTION("SocialWindow")
+ {
+ CREATEWIDGETV0(socialWindow, SocialWindow);
+ delete2(socialWindow);
+ }
+ SECTION("StatusWindow")
+ {
+ CREATEWIDGETV0(statusWindow, StatusWindow);
+ delete2(statusWindow);
+ }
+ SECTION("TextCommandEditor")
+ {
+ TextCommand *textCommand = new TextCommand(1, "", "", "",
+ CommandTarget::NoTarget, "");
+ TextCommandEditor *dialog = CREATEWIDGETR(TextCommandEditor,
+ textCommand);
+ delete2(dialog);
+ }
+ SECTION("TextDialog")
+ {
+ TextDialog *dialog = CREATEWIDGETR(TextDialog,
+ "", "", nullptr, false);
+ delete2(dialog);
+ }
+ SECTION("TextSelectDialog")
+ {
+ TextSelectDialog *dialog = CREATEWIDGETR(TextSelectDialog,
+ "", "", AllowQuit_false);
+ delete2(dialog);
+ }
+ SECTION("TradeWindow")
+ {
+ CREATEWIDGETV0(tradeWindow, TradeWindow);
+ delete2(tradeWindow);
+ }
+ SECTION("UpdaterWindow")
+ {
+ CREATEWIDGETV(updaterWindow, UpdaterWindow,
+ "", "", false, UpdateType::Skip);
+ delete2(updaterWindow);
+ }
+ SECTION("WhoIsOnline")
+ {
+ CREATEWIDGETV0(whoIsOnline, WhoIsOnline);
+ delete2(whoIsOnline);
+ }
+ SECTION("WorldSelectDialog")
+ {
+ Worlds worlds;
+ WorldSelectDialog *dialog = CREATEWIDGETR(WorldSelectDialog,
+ worlds);
+ delete2(dialog);
+ }
SECTION("popupMenu")
{
CREATEWIDGETV0(popupMenu, PopupMenu);
@@ -137,32 +528,6 @@ TEST_CASE("Windows tests", "windowmanager")
CREATEWIDGETV(desktop, Desktop, nullptr);
delete2(desktop);
}
- SECTION("serversDialog")
- {
- ServerInfo mCurrentServer;
- settings.configDir = PhysFs::getRealDir("test/serverlistplus.xml");;
- ServerDialog *serverDialog = CREATEWIDGETR(ServerDialog,
- &mCurrentServer,
- settings.configDir);
- delete2(serverDialog);
- }
- SECTION("connectionDialog")
- {
- ConnectionDialog *connectionDialog = CREATEWIDGETR(ConnectionDialog,
- // TRANSLATORS: connection dialog header
- _("Connecting to server"),
- State::SWITCH_SERVER);
- delete2(connectionDialog);
- }
- SECTION("loginDialog")
- {
- ServerInfo mCurrentServer;
- LoginDialog *loginDialog = CREATEWIDGETR(LoginDialog,
- loginData,
- &mCurrentServer,
- &settings.options.updateHost);
- delete2(loginDialog);
- }
SECTION("connectionDialog")
{
ConnectionDialog *connectionDialog = CREATEWIDGETR(ConnectionDialog,
@@ -177,5 +542,7 @@ TEST_CASE("Windows tests", "windowmanager")
delete2(userPalette);
delete2(client);
+ delete2(serverFeatures);
+ delete2(inventoryHandler);
windowContainer = nullptr;
}
diff --git a/src/gui/windows/itemamountwindow.h b/src/gui/windows/itemamountwindow.h
index c9cbd4227..a89bb83f5 100644
--- a/src/gui/windows/itemamountwindow.h
+++ b/src/gui/windows/itemamountwindow.h
@@ -85,7 +85,9 @@ class ItemAmountWindow final : public Window,
~ItemAmountWindow();
+#ifndef UNITTESTS
private:
+#endif
static void finish(Item *const item,
const int amount,
const int price,
diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp
index c9c6248e6..0f3ea0a4d 100644
--- a/src/gui/windows/ministatuswindow.cpp
+++ b/src/gui/windows/ministatuswindow.cpp
@@ -301,7 +301,8 @@ void MiniStatusWindow::attributeChanged(const AttributesT id,
void MiniStatusWindow::updateStatus()
{
- statusWindow->updateStatusBar(mStatusBar);
+ if (statusWindow)
+ statusWindow->updateStatusBar(mStatusBar);
if (mStatusPopup && mStatusPopup->isPopupVisible())
mStatusPopup->update();
}