TESTBED: some more refinements with handling Quit events in GUI

svn-id: r52078
This commit is contained in:
Neeraj Kumar 2010-08-14 06:06:41 +00:00
parent f9005dd4b3
commit 169d1eb0cc
5 changed files with 21 additions and 16 deletions

View file

@ -48,5 +48,5 @@ cd ..
# move the audiocd data to newly created directory # move the audiocd data to newly created directory
cp -r testbed-audiocd-files testbed/audiocd-files cp -r testbed-audiocd-files testbed/audiocd-files
mv testbed/audiocd-files/music.mid testbed/
echo "Game data created" echo "Game data created"

View file

@ -193,10 +193,8 @@ void TestbedConfigManager::writeTestbedConfigToStream(Common::WriteStream *ws) {
} }
Common::SeekableReadStream *TestbedConfigManager::getConfigReadStream() { Common::SeekableReadStream *TestbedConfigManager::getConfigReadStream() {
// Look for config file in game-path // Look for config file using SearchMan
const Common::String &path = ConfMan.get("path"); Common::SeekableReadStream *rs = SearchMan.createReadStreamForMember(_configFileName);
Common::FSDirectory gameRoot(path);
Common::SeekableReadStream *rs = gameRoot.createReadStreamForMember(_configFileName);
return rs; return rs;
} }
@ -231,6 +229,7 @@ void TestbedConfigManager::parseConfigFile() {
Common::ConfigFile::SectionKeyList kList = i->getKeys(); Common::ConfigFile::SectionKeyList kList = i->getKeys();
if (!currTS) { if (!currTS) {
Testsuite::logPrintf("Warning! Error in config: Testsuite %s not found\n", i->name.c_str()); Testsuite::logPrintf("Warning! Error in config: Testsuite %s not found\n", i->name.c_str());
continue;
} }
for (Common::ConfigFile::SectionKeyList::const_iterator j = kList.begin(); j != kList.end(); j++) { for (Common::ConfigFile::SectionKeyList::const_iterator j = kList.begin(); j != kList.end(); j++) {
@ -297,6 +296,9 @@ void TestbedConfigManager::selectTestsuites() {
Testsuite::logPrintf("Info! : Interactive tests are also being executed.\n"); Testsuite::logPrintf("Info! : Interactive tests are also being executed.\n");
if (Testsuite::handleInteractiveInput(prompt, "Proceed?", "Customize", kOptionRight)) { if (Testsuite::handleInteractiveInput(prompt, "Proceed?", "Customize", kOptionRight)) {
if (Engine::shouldQuit()) {
return;
}
// Select testsuites using checkboxes // Select testsuites using checkboxes
TestbedOptionsDialog tbd(_testsuiteList, this); TestbedOptionsDialog tbd(_testsuiteList, this);
tbd.runModal(); tbd.runModal();

View file

@ -138,9 +138,9 @@ TestExitStatus MidiTests::playMidiMusic() {
} }
MidiTestSuite::MidiTestSuite() { MidiTestSuite::MidiTestSuite() {
if (SearchMan.hasFile("music.mid")) {
addTest("MidiTests", &MidiTests::playMidiMusic); addTest("MidiTests", &MidiTests::playMidiMusic);
} else { _isMidiDataFound = true;
if (!SearchMan.hasFile("music.mid")) {
// add some fallback test if filesystem loading failed // add some fallback test if filesystem loading failed
Testsuite::logPrintf("Warning! Midi: Sound data file music.mid not found\n"); Testsuite::logPrintf("Warning! Midi: Sound data file music.mid not found\n");
_isMidiDataFound = false; _isMidiDataFound = false;

View file

@ -98,6 +98,11 @@ TestbedEngine::TestbedEngine(OSystem *syst)
// Do not initialize graphics here // Do not initialize graphics here
// However this is the place to specify all default directories // 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(kTestbedLogOutput, "LOG", "Log of test results generated by testbed");
DebugMan.addDebugChannel(kTestbedEngineDebug, "Debug", "Engine-specific debug statements"); DebugMan.addDebugChannel(kTestbedEngineDebug, "Debug", "Engine-specific debug statements");
@ -144,6 +149,9 @@ void TestbedEngine::invokeTestsuites(TestbedConfigManager &cfMan) {
int numSuitesEnabled = cfMan.getNumSuitesEnabled(); int numSuitesEnabled = cfMan.getNumSuitesEnabled();
for (iter = _testsuiteList.begin(); iter != _testsuiteList.end(); iter++) { for (iter = _testsuiteList.begin(); iter != _testsuiteList.end(); iter++) {
if (shouldQuit()) {
return;
}
(*iter)->reset(); (*iter)->reset();
if ((*iter)->isEnabled()) { if ((*iter)->isEnabled()) {
Testsuite::updateStats("Testsuite", (*iter)->getName(), count++, numSuitesEnabled, pt); Testsuite::updateStats("Testsuite", (*iter)->getName(), count++, numSuitesEnabled, pt);
@ -169,12 +177,12 @@ Common::Error TestbedEngine::run() {
cfMan.selectTestsuites(); cfMan.selectTestsuites();
// Init logging // Init logging
Testsuite::initLogging(true); Testsuite::initLogging(true);
invokeTestsuites(cfMan);
// Check if user wanted to exit. // Check if user wanted to exit.
if (Engine::shouldQuit()) { if (Engine::shouldQuit()) {
return Common::kNoError; return Common::kNoError;
} }
invokeTestsuites(cfMan);
TestbedExitDialog tbDialog(_testsuiteList); TestbedExitDialog tbDialog(_testsuiteList);
tbDialog.init(); tbDialog.init();
tbDialog.run(); tbDialog.run();

View file

@ -322,11 +322,6 @@ bool Testsuite::enableTest(const Common::String &testName, bool toEnable) {
void Testsuite::execute() { void Testsuite::execute() {
// Main Loop for a testsuite // Main Loop for a testsuite
// Do nothing if meant to exit
if (toQuit == kEngineQuit) {
return;
}
uint count = 0; uint count = 0;
Common::Point pt = getDisplayRegionCoordinates(); Common::Point pt = getDisplayRegionCoordinates();
pt.y += getLineSeparation(); pt.y += getLineSeparation();