3 Copyright (C) 2018 nerzhul, Loic BLOT <loic.blot@unix-experience.fr>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #include "client/gameui.h"
24 class TestGameUI : public TestBase
27 TestGameUI() { TestManager::registerTestModule(this); }
28 const char *getName() { return "TestGameUI"; }
30 void runTests(IGameDef *gamedef);
33 void testFlagSetters();
35 void testStatusText();
38 static TestGameUI g_test_instance;
40 void TestGameUI::runTests(IGameDef *gamedef)
43 TEST(testFlagSetters);
48 void TestGameUI::testInit()
52 UASSERT(gui.getFlags().show_chat)
53 UASSERT(gui.getFlags().show_hud)
55 // @TODO verify if we can create non UI nulldevice to test this function
59 void TestGameUI::testFlagSetters()
62 gui.showMinimap(true);
63 UASSERT(gui.getFlags().show_minimap);
65 gui.showMinimap(false);
66 UASSERT(!gui.getFlags().show_minimap);
69 void TestGameUI::testStatusText()
72 gui.showStatusText(L"test status");
74 UASSERT(gui.m_statustext_time == 0.0f);
75 UASSERT(gui.m_statustext == L"test status");
78 void TestGameUI::testInfoText()
81 gui.setInfoText(L"test info");
83 UASSERT(gui.m_infotext == L"test info");