diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2015-04-03 00:48:56 +0200 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2015-04-03 01:07:01 +0200 |
commit | 82cc9c0cf2cdb8de17233a2ea943a5247d5da305 (patch) | |
tree | af341aed11c15ac3ab54de6c62e56251c859d76f /test/menu | |
parent | 263ef7f8c7085b90f8d21e3dfc2598ed7340e73d (diff) | |
download | usdx-82cc9c0cf2cdb8de17233a2ea943a5247d5da305.tar.gz usdx-82cc9c0cf2cdb8de17233a2ea943a5247d5da305.tar.xz usdx-82cc9c0cf2cdb8de17233a2ea943a5247d5da305.zip |
menu/application: Remove singleton.
The singleton pattern should not be used in most cases, because it
behaves like global variables.
Diffstat (limited to 'test/menu')
-rw-r--r-- | test/menu/application.cpp | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/test/menu/application.cpp b/test/menu/application.cpp index 20be3542..8a14644a 100644 --- a/test/menu/application.cpp +++ b/test/menu/application.cpp @@ -41,38 +41,29 @@ namespace usdx private: static log4cpp::Category& log; public: - void setUp() - { - Application::get_instance(); - } - - void tearDown() - { - Application::free(); - } - void testQuitBeforeRun() { Timestamp t; - Application::get_instance()->quit(); - CPPUNIT_ASSERT_EQUAL(false, Application::get_instance()->is_running()); + Application app; + app.quit(); + CPPUNIT_ASSERT_EQUAL(false, app.is_running()); CPPUNIT_ASSERT_EQUAL(true, t.since(0.2)); } void testNewInstance() { int fps; + Application app; + Application app2; // change fps - fps = Application::get_instance()->get_frames_per_second(); - Application::get_instance()->set_frames_per_second(fps + 23); + fps = app.get_frames_per_second(); + app.set_frames_per_second(fps + 23); - // reset instance - Application::free(); - // check if fps changed back - CPPUNIT_ASSERT_EQUAL(fps, Application::get_instance()->get_frames_per_second()); + // check if other instance is independent + CPPUNIT_ASSERT_EQUAL(fps, app2.get_frames_per_second()); } }; |