From bb6e522a1c35b463e2fc51b048a4aaa5c3fc35ba Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 2 Aug 2016 17:20:30 +0300 Subject: Fix some broken window draw unit tests. --- src/gui/widgets/characterdisplay.cpp | 6 ++++-- src/gui/windowmanager_unittest.cc | 12 ++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/gui/widgets/characterdisplay.cpp b/src/gui/widgets/characterdisplay.cpp index 7aa9fe795..9ab8c2488 100644 --- a/src/gui/widgets/characterdisplay.cpp +++ b/src/gui/widgets/characterdisplay.cpp @@ -111,12 +111,14 @@ void CharacterDisplay::update() void CharacterDisplay::widgetHidden(const Event &event A_UNUSED) { - textPopup->setVisible(Visible_false); + if (textPopup) + textPopup->setVisible(Visible_false); } void CharacterDisplay::mouseExited(MouseEvent &event A_UNUSED) { - textPopup->setVisible(Visible_false); + if (textPopup) + textPopup->setVisible(Visible_false); } void CharacterDisplay::mouseMoved(MouseEvent &event A_UNUSED) diff --git a/src/gui/windowmanager_unittest.cc b/src/gui/windowmanager_unittest.cc index 5366f3e9a..b58d610d2 100644 --- a/src/gui/windowmanager_unittest.cc +++ b/src/gui/windowmanager_unittest.cc @@ -47,6 +47,7 @@ #include "gui/windows/buydialog.h" #include "gui/windows/buyingstoreselldialog.h" #include "gui/windows/buyselldialog.h" +#include "gui/windows/charselectdialog.h" #include "gui/windows/changeemaildialog.h" #include "gui/windows/changepassworddialog.h" #include "gui/windows/chatwindow.h" @@ -97,6 +98,7 @@ #include "net/logindata.h" +#include "net/eathena/charserverhandler.h" #include "net/eathena/inventoryhandler.h" #include "net/eathena/serverfeatures.h" #include "net/eathena/playerhandler.h" @@ -145,6 +147,7 @@ TEST_CASE("Windows tests", "windowmanager") gui->postInit(mainGraphics); touchManager.init(); Units::loadUnits(); + charServerHandler = new EAthena::CharServerHandler; serverFeatures = new EAthena::ServerFeatures; inventoryHandler = new EAthena::InventoryHandler; playerHandler = new EAthena::PlayerHandler; @@ -203,24 +206,29 @@ TEST_CASE("Windows tests", "windowmanager") mainGraphics->updateScreen(); delete2(dialog); } -/* SECTION("CharSelectDialog") { LoginData data; CharSelectDialog *dialog; CREATEWIDGETV(dialog, CharSelectDialog, data); + gui->draw(); + mainGraphics->updateScreen(); + delete2(dialog); } SECTION("CharCreateDialog") { +/* LoginData data; CharSelectDialog *dialog2; CREATEWIDGETV(dialog2, CharSelectDialog, data); CharCreateDialog *dialog; CREATEWIDGETV(dialog, CharCreateDialog, dialog2, 0); + gui->draw(); + mainGraphics->updateScreen(); delete2(dialog); delete2(dialog2); - } */ + } SECTION("ChatWindow") { CREATEWIDGETV0(chatWindow, ChatWindow); -- cgit v1.2.3-70-g09d2