Fix GameUI flag value regression introduced by a78659ed05

Added more strong unittests on that part to prevent future regression
master
Loic Blot 2018-05-29 08:34:09 +02:00
parent 67ed56be3b
commit 75aa41c6de
No known key found for this signature in database
GPG Key ID: EFAA458E8C153987
3 changed files with 11 additions and 4 deletions

View File

@ -189,8 +189,6 @@ void GameUI::update(const RunStats &stats, Client *client, MapDrawControl *draw_
void GameUI::initFlags()
{
m_flags = GameUI::Flags();
m_flags.show_chat = true;
m_flags.show_hud = true;
m_flags.show_debug = g_settings->getBool("show_debug");
}

View File

@ -54,9 +54,9 @@ public:
{
bool show_chat = true;
bool show_hud = true;
bool show_minimap = true;
bool show_minimap = false;
bool show_debug = true;
bool show_profiler_graph = true;
bool show_profiler_graph = false;
};
void init();

View File

@ -48,9 +48,18 @@ void TestGameUI::runTests(IGameDef *gamedef)
void TestGameUI::testInit()
{
GameUI gui{};
// Ensure flags on GameUI init
UASSERT(gui.getFlags().show_chat)
UASSERT(gui.getFlags().show_hud)
UASSERT(!gui.getFlags().show_minimap)
UASSERT(!gui.getFlags().show_profiler_graph)
// And after the initFlags init stage
gui.initFlags();
UASSERT(gui.getFlags().show_chat)
UASSERT(gui.getFlags().show_hud)
UASSERT(!gui.getFlags().show_minimap)
UASSERT(!gui.getFlags().show_profiler_graph)
// @TODO verify if we can create non UI nulldevice to test this function
// gui.init();