[Scummvm-cvs-logs] SF.net SVN: scummvm:[52041] scummvm/branches/gsoc2010-testbed/engines/ testbed

sud03r at users.sourceforge.net sud03r at users.sourceforge.net
Thu Aug 12 16:47:26 CEST 2010


Revision: 52041
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52041&view=rev
Author:   sud03r
Date:     2010-08-12 14:47:25 +0000 (Thu, 12 Aug 2010)

Log Message:
-----------
TESTBED: disable tests when required data is not found

Modified Paths:
--------------
    scummvm/branches/gsoc2010-testbed/engines/testbed/midi.cpp
    scummvm/branches/gsoc2010-testbed/engines/testbed/midi.h
    scummvm/branches/gsoc2010-testbed/engines/testbed/sound.cpp
    scummvm/branches/gsoc2010-testbed/engines/testbed/sound.h

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/midi.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/midi.cpp	2010-08-12 14:01:28 UTC (rev 52040)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/midi.cpp	2010-08-12 14:47:25 UTC (rev 52041)
@@ -128,6 +128,7 @@
 	driver->setTimerCallback(NULL, NULL);
 	driver->close();
 	delete smfParser;
+	delete driver;
 	
 	if (Testsuite::handleInteractiveInput("Were you able to hear the music as described?", "Yes", "No", kOptionRight)) {
 		Testsuite::logDetailedPrintf("Error! Midi: Can't play Music\n");
@@ -137,7 +138,18 @@
 }
 
 MidiTestSuite::MidiTestSuite() {
-	addTest("MidiTests", &MidiTests::playMidiMusic);
+	if (SearchMan.hasFile("music.mid")) {
+		addTest("MidiTests", &MidiTests::playMidiMusic);
+	} else {
+		// add some fallback test if filesystem loading failed
+		Testsuite::logPrintf("Warning! Midi: Sound data file music.mid not found\n");
+		_isMidiDataFound = false;
+		enable(false);
+	}
 }
 
+void MidiTestSuite::enable(bool flag) {
+	Testsuite::enable(_isMidiDataFound & flag);
 }
+
+}

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/midi.h
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/midi.h	2010-08-12 14:01:28 UTC (rev 52040)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/midi.h	2010-08-12 14:47:25 UTC (rev 52041)
@@ -64,7 +64,12 @@
 	const char *getDescription() const {
 		return "Midi Music";
 	}
+	
+	void enable(bool flag);
 
+private:
+	bool _isMidiDataFound;
+
 };
 
 } // End of namespace Testbed

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/sound.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/sound.cpp	2010-08-12 14:01:28 UTC (rev 52040)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/sound.cpp	2010-08-12 14:47:25 UTC (rev 52041)
@@ -187,10 +187,7 @@
 	Common::Point pt(0, 100);
 	Testsuite::writeOnScreen("Playing the tracks of testCD in order i.e 1-2-3-last", pt);
 
-	// Make audio-files discoverable
-	Common::FSNode gameRoot(ConfMan.get("path"));
-	SearchMan.addSubDirectoryMatching(gameRoot, "audiocd-files");
-
+	
 	// Play all tracks
 	for (int i = 1; i < 5; i++) { 
 		AudioCD.play(i, 1, 0, 0);
@@ -266,7 +263,17 @@
 SoundSubsystemTestSuite::SoundSubsystemTestSuite() {
 	addTest("SimpleBeeps", &SoundSubsystem::playBeeps, true);
 	addTest("MixSounds", &SoundSubsystem::mixSounds, true);
-	addTest("AudiocdOutput", &SoundSubsystem::audiocdOutput, true);
+	
+	// Make audio-files discoverable
+	Common::FSNode gameRoot(ConfMan.get("path"));
+	if (gameRoot.exists()) {
+		SearchMan.addSubDirectoryMatching(gameRoot, "audiocd-files");
+		if (SearchMan.hasFile("track01.mp3") && SearchMan.hasFile("track02.mp3") && SearchMan.hasFile("track03.mp3") && SearchMan.hasFile("track04.mp3")) {
+			addTest("AudiocdOutput", &SoundSubsystem::audiocdOutput, true);
+		} else {
+			Testsuite::logPrintf("Warning! Skipping test AudioCD: Required data files missing, check game-dir/audiocd-files\n");
+		}
+	}
 	addTest("SampleRates", &SoundSubsystem::sampleRates, true);
 }
 

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/sound.h
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/sound.h	2010-08-12 14:01:28 UTC (rev 52040)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/sound.h	2010-08-12 14:47:25 UTC (rev 52041)
@@ -73,6 +73,9 @@
 		return "Sound Subsystem";
 	}
 
+private:
+	bool _isTestDataFound;
+
 };
 
 } // End of namespace Testbed


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list