diff options
Diffstat (limited to 'engines/testbed/testbed.cpp')
-rw-r--r-- | engines/testbed/testbed.cpp | 63 |
1 files changed, 43 insertions, 20 deletions
diff --git a/engines/testbed/testbed.cpp b/engines/testbed/testbed.cpp index ef61cd7c13..071fba8c2c 100644 --- a/engines/testbed/testbed.cpp +++ b/engines/testbed/testbed.cpp @@ -31,6 +31,7 @@ #include "testbed/events.h" #include "testbed/fs.h" #include "testbed/graphics.h" +#include "testbed/midi.h" #include "testbed/misc.h" #include "testbed/savegame.h" #include "testbed/sound.h" @@ -44,27 +45,38 @@ void TestbedExitDialog::init() { Common::String text = "Thank you for using ScummVM testbed! Here are yor summarized results:"; addText(450, 20, text, Graphics::kTextAlignCenter, _xOffset, 15); Common::Array<Common::String> strArray; - + GUI::ListWidget::ColorList colors; + for (Common::Array<Testsuite *>::const_iterator i = _testsuiteList.begin(); i != _testsuiteList.end(); ++i) { - strArray.push_back(Common::String::printf("%s (%d/%d tests failed)", (*i)->getName(), (*i)->getNumTestsFailed(), - (*i)->getNumTestsEnabled())); + strArray.push_back(Common::String::printf("%s :", (*i)->getDescription())); + colors.push_back(GUI::ThemeEngine::kFontColorNormal); + if ((*i)->isEnabled()) { + strArray.push_back(Common::String::printf("Passed: %d Failed: %d Skipped: %d", (*i)->getNumTestsPassed(), (*i)->getNumTestsFailed(), (*i)->getNumTestsSkipped())); + } else { + strArray.push_back("Skipped"); + } + colors.push_back(GUI::ThemeEngine::kFontColorAlternate); } - - addList(0, _yOffset, 500, 200, strArray); - text = "More Details can be viewed in the Log file : " + Testsuite::getLogFile(); + + addList(0, _yOffset, 500, 200, strArray, &colors); + text = "More Details can be viewed in the Log file : " + ConfParams.getLogFilename(); addText(450, 20, text, Graphics::kTextAlignLeft, 0, 0); - text = "Directory : " + Testsuite::getLogDir(); + if (ConfParams.getLogDirectory().size()) { + text = "Directory : " + ConfParams.getLogDirectory(); + } else { + text = "Directory : ."; + } addText(500, 20, text, Graphics::kTextAlignLeft, 0, 0); _yOffset += 5; - addButtonXY(_xOffset + 80, _yOffset, 120, 20, "Rerun Tests", kCmdRerunTestbed); - addButtonXY(_xOffset + 240, _yOffset, 60, 20, "Close", GUI::kCloseCmd); + addButtonXY(_xOffset + 80, _yOffset, 120, 24, "Rerun test suite", kCmdRerunTestbed); + addButtonXY(_xOffset + 240, _yOffset, 60, 24, "Close", GUI::kCloseCmd); } void TestbedExitDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) { switch (cmd) { case kCmdRerunTestbed : - _rerun = true; - GUI::Dialog::close(); + ConfParams.setRerunFlag(true); + cmd = GUI::kCloseCmd; default: GUI::Dialog::handleCommand(sender, cmd, data); } @@ -83,6 +95,11 @@ TestbedEngine::TestbedEngine(OSystem *syst) // Do not initialize graphics here // However this is the place to specify all default directories + // Put game-data dir in search path + Common::FSNode gameRoot(ConfMan.get("path")); + if (gameRoot.exists()) { + SearchMan.addDirectory(gameRoot.getDisplayName(), gameRoot); + } DebugMan.addDebugChannel(kTestbedLogOutput, "LOG", "Log of test results generated by testbed"); DebugMan.addDebugChannel(kTestbedEngineDebug, "Debug", "Engine-specific debug statements"); @@ -107,10 +124,13 @@ TestbedEngine::TestbedEngine(OSystem *syst) // Sound ts = new SoundSubsystemTestSuite(); _testsuiteList.push_back(ts); + // Midi + ts = new MidiTestSuite(); + _testsuiteList.push_back(ts); } TestbedEngine::~TestbedEngine() { - Testsuite::deleteWriteStream(); + ConfParams.deleteWriteStream(); // Remove all of our debug levels here DebugMan.clearAllDebugChannels(); @@ -126,6 +146,9 @@ void TestbedEngine::invokeTestsuites(TestbedConfigManager &cfMan) { int numSuitesEnabled = cfMan.getNumSuitesEnabled(); for (iter = _testsuiteList.begin(); iter != _testsuiteList.end(); iter++) { + if (shouldQuit()) { + return; + } (*iter)->reset(); if ((*iter)->isEnabled()) { Testsuite::updateStats("Testsuite", (*iter)->getName(), count++, numSuitesEnabled, pt); @@ -143,26 +166,26 @@ Common::Error TestbedEngine::run() { // TODO: Implement that TestbedConfigManager cfMan(_testsuiteList, "testbed.config"); - - // Keep running if rerun requested - TestbedExitDialog tbDialog(_testsuiteList); + + // Keep running if rerun requested do { Testsuite::clearEntireScreen(); cfMan.selectTestsuites(); // Init logging - Testsuite::initLogging(true); + ConfParams.initLogging(true); + invokeTestsuites(cfMan); // Check if user wanted to exit. if (Engine::shouldQuit()) { return Common::kNoError; } - - invokeTestsuites(cfMan); + + TestbedExitDialog tbDialog(_testsuiteList); tbDialog.init(); tbDialog.run(); - } while (tbDialog.rerunRequired()); - + } while (ConfParams.isRerunRequired()); + return Common::kNoError; } |