diff options
Diffstat (limited to 'engines/testbed/testbed.cpp')
-rw-r--r-- | engines/testbed/testbed.cpp | 62 |
1 files changed, 52 insertions, 10 deletions
diff --git a/engines/testbed/testbed.cpp b/engines/testbed/testbed.cpp index 3bb2490cf3..76ad50baa1 100644 --- a/engines/testbed/testbed.cpp +++ b/engines/testbed/testbed.cpp @@ -33,7 +33,6 @@ #include "testbed/misc.h" #include "testbed/savegame.h" #include "testbed/testbed.h" -#include "testbed/testsuite.h" namespace Testbed { @@ -50,12 +49,55 @@ TestbedEngine::TestbedEngine(OSystem *syst) DebugMan.addDebugChannel(kTestbedLogOutput, "LOG", "Log of test results generated by testbed"); DebugMan.addDebugChannel(kTestbedEngineDebug, "Debug", "Engine-specific debug statements"); DebugMan.enableDebugChannel("LOG"); + + // Initialize testsuites here + // GFX + Testsuite *ts = new GFXTestSuite(); + _testsuiteList.push_back(ts); + // FS + ts = new FSTestSuite(); + _testsuiteList.push_back(ts); + // Savegames + ts = new SaveGameTestSuite(); + _testsuiteList.push_back(ts); + // Misc. + ts = new MiscTestSuite(); + _testsuiteList.push_back(ts); } TestbedEngine::~TestbedEngine() { Testsuite::deleteWriteStream(); // Remove all of our debug levels here DebugMan.clearAllDebugChannels(); + + for (Common::Array<Testsuite*>::const_iterator i = _testsuiteList.begin(); i != _testsuiteList.end(); ++i) { + delete (*i); + } +} + +void TestbedEngine::enableTestsuite(const char *name, bool enable) { + Common::Array<Testsuite*>::const_iterator iter; + Common::String tsName(name); + + + for (iter = _testsuiteList.begin(); iter != _testsuiteList.end(); iter++) { + if (tsName.equalsIgnoreCase((*iter)->getName())) { + (*iter)->enable(enable); + break; + } + } + + return; +} + +void TestbedEngine::invokeTestsuites() { + Common::Array<Testsuite*>::const_iterator iter; + + for (iter = _testsuiteList.begin(); iter != _testsuiteList.end(); iter++) { + if ((*iter)->isEnabled()) { + (*iter)->execute(); + } + } } Common::Error TestbedEngine::run() { @@ -73,9 +115,9 @@ Common::Error TestbedEngine::run() { // To be set from config file // By default Interactive tests are enabled // XXX: disabling these as of now for fastly testing other tests - Testsuite::isInteractive = false; + Testsuite::isSessionInteractive = false; - if (Testsuite::isInteractive) { + if (Testsuite::isSessionInteractive) { Testsuite::logPrintf("Info! : Interactive tests are also being executed.\n"); Testsuite::displayMessage(prompt, "Proceed?"); // Executing GFX Tests @@ -83,14 +125,14 @@ Common::Error TestbedEngine::run() { gts.execute(); } - FSTestSuite fts; - fts.execute(); - - SaveGameTestSuite sts; - sts.execute(); + // Enable the testsuites you want to execute + enableTestsuite("FS", true); + enableTestsuite("GFX", true); + enableTestsuite("savegames", true); + enableTestsuite("misc", true); + // invoke them + invokeTestsuites(); - MiscTestSuite mts; - mts.execute(); return Common::kNoError; } |