aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeeraj Kumar2010-08-14 06:06:41 +0000
committerNeeraj Kumar2010-08-14 06:06:41 +0000
commit169d1eb0cc52438b00ad204a407b6eeb93fb8614 (patch)
tree2aee585cc34d71dfd94a64ae14aa8584d92cb0ac
parentf9005dd4b3c362ec4dedeace7d288a3da16d04e6 (diff)
downloadscummvm-rg350-169d1eb0cc52438b00ad204a407b6eeb93fb8614.tar.gz
scummvm-rg350-169d1eb0cc52438b00ad204a407b6eeb93fb8614.tar.bz2
scummvm-rg350-169d1eb0cc52438b00ad204a407b6eeb93fb8614.zip
TESTBED: some more refinements with handling Quit events in GUI
svn-id: r52078
-rwxr-xr-xdists/engine-data/create-testbed-data.sh2
-rw-r--r--engines/testbed/config.cpp12
-rw-r--r--engines/testbed/midi.cpp6
-rw-r--r--engines/testbed/testbed.cpp12
-rw-r--r--engines/testbed/testsuite.cpp5
5 files changed, 21 insertions, 16 deletions
diff --git a/dists/engine-data/create-testbed-data.sh b/dists/engine-data/create-testbed-data.sh
index 0200803caa..754ec4d683 100755
--- a/dists/engine-data/create-testbed-data.sh
+++ b/dists/engine-data/create-testbed-data.sh
@@ -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"
diff --git a/engines/testbed/config.cpp b/engines/testbed/config.cpp
index f64f1f34d7..732e44e939 100644
--- a/engines/testbed/config.cpp
+++ b/engines/testbed/config.cpp
@@ -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++) {
@@ -295,8 +294,11 @@ 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();
diff --git a/engines/testbed/midi.cpp b/engines/testbed/midi.cpp
index bae78b352b..f5e92982c2 100644
--- a/engines/testbed/midi.cpp
+++ b/engines/testbed/midi.cpp
@@ -138,9 +138,9 @@ TestExitStatus MidiTests::playMidiMusic() {
}
MidiTestSuite::MidiTestSuite() {
- if (SearchMan.hasFile("music.mid")) {
- addTest("MidiTests", &MidiTests::playMidiMusic);
- } else {
+ addTest("MidiTests", &MidiTests::playMidiMusic);
+ _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;
diff --git a/engines/testbed/testbed.cpp b/engines/testbed/testbed.cpp
index 51ff43a293..e538c7f20c 100644
--- a/engines/testbed/testbed.cpp
+++ b/engines/testbed/testbed.cpp
@@ -98,7 +98,12 @@ 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");
DebugMan.enableDebugChannel("LOG");
@@ -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();
diff --git a/engines/testbed/testsuite.cpp b/engines/testbed/testsuite.cpp
index 3f98938e75..dff96f73f4 100644
--- a/engines/testbed/testsuite.cpp
+++ b/engines/testbed/testsuite.cpp
@@ -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();