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
cp -r testbed-audiocd-files testbed/audiocd-files
mv testbed/audiocd-files/music.mid testbed/
echo "Game data created"

View File

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

View File

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

View File

@ -98,6 +98,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");
@ -144,6 +149,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);
@ -169,12 +177,12 @@ Common::Error TestbedEngine::run() {
cfMan.selectTestsuites();
// Init logging
Testsuite::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();

View File

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