diff options
author | Loic Blot <loic.blot@unix-experience.fr> | 2018-01-04 21:35:26 +0100 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2018-01-05 20:59:30 +0100 |
commit | fe510d90c15d9bec3a8c1dafc7b1730b11a9f6bd (patch) | |
tree | b4c2626053fa8e4dceedbb0a061724843c667161 /src/unittest/test_gameui.cpp | |
parent | aab3b18e4b9f847ba1e521d5a73624b0bb6a467a (diff) | |
download | minetest-fe510d90c15d9bec3a8c1dafc7b1730b11a9f6bd.tar.gz minetest-fe510d90c15d9bec3a8c1dafc7b1730b11a9f6bd.tar.bz2 minetest-fe510d90c15d9bec3a8c1dafc7b1730b11a9f6bd.zip |
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
Diffstat (limited to 'src/unittest/test_gameui.cpp')
-rw-r--r-- | src/unittest/test_gameui.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/unittest/test_gameui.cpp b/src/unittest/test_gameui.cpp index d52977469..9bc9d8cf5 100644 --- a/src/unittest/test_gameui.cpp +++ b/src/unittest/test_gameui.cpp @@ -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"); +} |