mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-12 16:58:39 +00:00
Fix GameUI flag value regression introduced by a78659ed05
Added more strong unittests on that part to prevent future regression
This commit is contained in:
parent
67ed56be3b
commit
75aa41c6de
3 changed files with 11 additions and 4 deletions
|
@ -189,8 +189,6 @@ void GameUI::update(const RunStats &stats, Client *client, MapDrawControl *draw_
|
||||||
void GameUI::initFlags()
|
void GameUI::initFlags()
|
||||||
{
|
{
|
||||||
m_flags = GameUI::Flags();
|
m_flags = GameUI::Flags();
|
||||||
m_flags.show_chat = true;
|
|
||||||
m_flags.show_hud = true;
|
|
||||||
m_flags.show_debug = g_settings->getBool("show_debug");
|
m_flags.show_debug = g_settings->getBool("show_debug");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,9 +54,9 @@ public:
|
||||||
{
|
{
|
||||||
bool show_chat = true;
|
bool show_chat = true;
|
||||||
bool show_hud = true;
|
bool show_hud = true;
|
||||||
bool show_minimap = true;
|
bool show_minimap = false;
|
||||||
bool show_debug = true;
|
bool show_debug = true;
|
||||||
bool show_profiler_graph = true;
|
bool show_profiler_graph = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
|
|
@ -48,9 +48,18 @@ void TestGameUI::runTests(IGameDef *gamedef)
|
||||||
void TestGameUI::testInit()
|
void TestGameUI::testInit()
|
||||||
{
|
{
|
||||||
GameUI gui{};
|
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();
|
gui.initFlags();
|
||||||
UASSERT(gui.getFlags().show_chat)
|
UASSERT(gui.getFlags().show_chat)
|
||||||
UASSERT(gui.getFlags().show_hud)
|
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
|
// @TODO verify if we can create non UI nulldevice to test this function
|
||||||
// gui.init();
|
// gui.init();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue