mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 00:25:19 +02:00
GameUI refactor (part 4/X): Move Game::guitext_status, Game::m_statustext, GameRunData::statustext_time to GameUI class
Other enhancements: * Simplify setStatusText to showStatusText, as it shows the label too (preventing almost every setStatusText to call setStatusTextTime(0) * Add unittests
This commit is contained in:
@@ -31,6 +31,8 @@ public:
|
||||
|
||||
void testInit();
|
||||
void testFlagSetters();
|
||||
void testInfoText();
|
||||
void testStatusText();
|
||||
};
|
||||
|
||||
static TestGameUI g_test_instance;
|
||||
@@ -39,6 +41,8 @@ void TestGameUI::runTests(IGameDef *gamedef)
|
||||
{
|
||||
TEST(testInit);
|
||||
TEST(testFlagSetters);
|
||||
TEST(testInfoText);
|
||||
TEST(testStatusText);
|
||||
}
|
||||
|
||||
void TestGameUI::testInit()
|
||||
@@ -61,3 +65,20 @@ void TestGameUI::testFlagSetters()
|
||||
gui.showMinimap(false);
|
||||
UASSERT(!gui.getFlags().show_minimap);
|
||||
}
|
||||
|
||||
void TestGameUI::testStatusText()
|
||||
{
|
||||
GameUI gui{};
|
||||
gui.showStatusText(L"test status");
|
||||
|
||||
UASSERT(gui.m_statustext_time == 0.0f);
|
||||
UASSERT(gui.m_statustext == L"test status");
|
||||
}
|
||||
|
||||
void TestGameUI::testInfoText()
|
||||
{
|
||||
GameUI gui{};
|
||||
gui.setInfoText(L"test info");
|
||||
|
||||
UASSERT(gui.m_infotext == L"test info");
|
||||
}
|
||||
|
Reference in New Issue
Block a user