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

sud03r at users.sourceforge.net sud03r at users.sourceforge.net
Tue Jul 27 11:32:19 CEST 2010


Revision: 51351
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51351&view=rev
Author:   sud03r
Date:     2010-07-27 09:32:19 +0000 (Tue, 27 Jul 2010)

Log Message:
-----------
TESTBED: Updated the progress bar to show count of enabled test/testsuites instead of entire list size

Modified Paths:
--------------
    scummvm/branches/gsoc2010-testbed/engines/testbed/config.cpp
    scummvm/branches/gsoc2010-testbed/engines/testbed/config.h
    scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.cpp
    scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.h
    scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.cpp
    scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.h

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/config.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/config.cpp	2010-07-27 09:17:57 UTC (rev 51350)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/config.cpp	2010-07-27 09:32:19 UTC (rev 51351)
@@ -200,6 +200,15 @@
 	delete rs;
 }
 
+int TestbedConfigManager::getNumSuitesEnabled() {
+	int count = 0;
+	for (uint i = 0; i < _testsuiteList.size(); i++) {
+        if (_testsuiteList[i]->isEnabled()) {
+        	count++;
+		}
+    }
+    return count;
+}
 
 Testsuite *TestbedConfigManager::getTestsuiteByName(const Common::String &name) {
 	for (uint i = 0; i < _testsuiteList.size(); i++) {

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/config.h
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/config.h	2010-07-27 09:17:57 UTC (rev 51350)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/config.h	2010-07-27 09:32:19 UTC (rev 51351)
@@ -60,6 +60,8 @@
 	bool stringToBool(const Common::String str) { return str.equalsIgnoreCase("true") ? true : false; }
 	Common::String boolToString(bool val) { return val ? "true" : "false"; }
 	void initDefaultConfiguration();
+	int getNumSuitesEnabled();
+
 private:
 	Common::Array<Testsuite *> &_testsuiteList;
 	Common::String	_configFileName;

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.cpp	2010-07-27 09:17:57 UTC (rev 51350)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.cpp	2010-07-27 09:32:19 UTC (rev 51351)
@@ -88,14 +88,15 @@
 	}
 }
 
-void TestbedEngine::invokeTestsuites() {
+void TestbedEngine::invokeTestsuites(TestbedConfigManager &cfMan) {
 	Common::Array<Testsuite *>::const_iterator iter;
 	uint count = 1;
 	Common::Point pt = Testsuite::getDisplayRegionCoordinates();
+	int numSuitesEnabled = cfMan.getNumSuitesEnabled();
 
 	for (iter = _testsuiteList.begin(); iter != _testsuiteList.end(); iter++) {
 		if ((*iter)->isEnabled()) {
-			Testsuite::updateStats("Testsuite", (*iter)->getName(), count++, _testsuiteList.size(), pt);
+			Testsuite::updateStats("Testsuite", (*iter)->getName(), count++, numSuitesEnabled, pt);
 			(*iter)->execute();
 		}
 	}
@@ -120,7 +121,7 @@
 		return Common::kNoError;
 	}
 	
-	invokeTestsuites();
+	invokeTestsuites(cfMan);
 	return Common::kNoError;
 }
 

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.h
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.h	2010-07-27 09:17:57 UTC (rev 51350)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.h	2010-07-27 09:32:19 UTC (rev 51351)
@@ -33,6 +33,8 @@
 
 namespace Testbed {
 
+class TestbedConfigManager;
+
 enum {
 	kTestbedLogOutput = 1 << 0,
 	kTestbedEngineDebug = 1 << 2
@@ -48,7 +50,7 @@
 	/**
 	 * Invokes configured testsuites.
 	 */
-	void invokeTestsuites();
+	void invokeTestsuites(TestbedConfigManager &cfMan);
 
 	bool hasFeature(EngineFeature f) const;
 

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.cpp	2010-07-27 09:17:57 UTC (rev 51350)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.cpp	2010-07-27 09:32:19 UTC (rev 51351)
@@ -219,6 +219,17 @@
 	_testsToExecute.push_back(featureTest);
 }
 
+const int Testsuite::getNumTestsEnabled() {
+	int count = 0;
+	Common::Array<Test *>::const_iterator iter;
+	for (iter = _testsToExecute.begin(); iter != _testsToExecute.end(); iter++) {
+		if ((*iter)->enabled) {
+			count++;
+		}
+	}
+	return count;
+}
+
 uint Testsuite::parseEvents() {
 	uint startTime = g_system->getMillis();
 	uint end = startTime + kEventHandlingTime;
@@ -288,6 +299,7 @@
 	return false;
 }
 
+
 void Testsuite::execute() {
 	// Main Loop for a testsuite
 
@@ -299,6 +311,7 @@
 	uint count = 0;
 	Common::Point pt = getDisplayRegionCoordinates();
 	pt.y += getLineSeparation();
+	int numEnabledTests = getNumTestsEnabled();
 
 	for (Common::Array<Test *>::iterator i = _testsToExecute.begin(); i != _testsToExecute.end(); ++i) {
 		if (!(*i)->enabled) {
@@ -318,7 +331,7 @@
 		}
 
 		logPrintf("Info! Executing Test: %s\n", ((*i)->featureName).c_str());
-		updateStats("Test", ((*i)->featureName).c_str(), count++, _testsToExecute.size(), pt);
+		updateStats("Test", ((*i)->featureName).c_str(), count++, numEnabledTests, pt);
 		_numTestsExecuted++;
 		if ((*i)->driver()) {
 			logPrintf("Result: Passed\n");
@@ -326,7 +339,7 @@
 		} else {
 			logPrintf("Result: Failed\n");
 		}
-		updateStats("Test", ((*i)->featureName).c_str(), count, _testsToExecute.size(), pt);
+		updateStats("Test", ((*i)->featureName).c_str(), count, numEnabledTests, pt);
 		// TODO: Display a screen here to user with details of upcoming test, he can skip it or Quit or RTL
 		// Check if user wants to quit/RTL/Skip next test by parsing events.
 		// Quit directly if explicitly requested

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.h
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.h	2010-07-27 09:17:57 UTC (rev 51350)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.h	2010-07-27 09:32:19 UTC (rev 51351)
@@ -171,8 +171,8 @@
 
 	static void updateStats(const char *prefix, const char *info, uint numTests, uint testNum, Common::Point pt);
 	const Common::Array<Test *>& getTestList() { return _testsToExecute; }
+	const int getNumTestsEnabled();
 
-
 protected:
 	Common::Array<Test *> _testsToExecute;			///< List of tests to be executed
 	int		    _numTestsPassed;					///< Number of tests passed


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