diff options
author | Neeraj Kumar | 2010-07-27 09:32:19 +0000 |
---|---|---|
committer | Neeraj Kumar | 2010-07-27 09:32:19 +0000 |
commit | 26c0547e6741fd57ddce8c2cfcccbe6dd2b54322 (patch) | |
tree | 0006bf942b6096636d9e7365e6fb95e6428b6602 /engines | |
parent | 39780f4a6801091fc680c7d55d2a1f7a0a4356be (diff) | |
download | scummvm-rg350-26c0547e6741fd57ddce8c2cfcccbe6dd2b54322.tar.gz scummvm-rg350-26c0547e6741fd57ddce8c2cfcccbe6dd2b54322.tar.bz2 scummvm-rg350-26c0547e6741fd57ddce8c2cfcccbe6dd2b54322.zip |
TESTBED: Updated the progress bar to show count of enabled test/testsuites instead of entire list size
svn-id: r51351
Diffstat (limited to 'engines')
-rw-r--r-- | engines/testbed/config.cpp | 9 | ||||
-rw-r--r-- | engines/testbed/config.h | 2 | ||||
-rw-r--r-- | engines/testbed/testbed.cpp | 7 | ||||
-rw-r--r-- | engines/testbed/testbed.h | 4 | ||||
-rw-r--r-- | engines/testbed/testsuite.cpp | 17 | ||||
-rw-r--r-- | engines/testbed/testsuite.h | 2 |
6 files changed, 34 insertions, 7 deletions
diff --git a/engines/testbed/config.cpp b/engines/testbed/config.cpp index 16194d90ce..7342f9d634 100644 --- a/engines/testbed/config.cpp +++ b/engines/testbed/config.cpp @@ -200,6 +200,15 @@ void TestbedConfigManager::parseConfigFile() { 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++) { diff --git a/engines/testbed/config.h b/engines/testbed/config.h index 2ecbf44930..bbab1b9405 100644 --- a/engines/testbed/config.h +++ b/engines/testbed/config.h @@ -60,6 +60,8 @@ public: 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; diff --git a/engines/testbed/testbed.cpp b/engines/testbed/testbed.cpp index 7eeb33a70d..bb9d81d4e8 100644 --- a/engines/testbed/testbed.cpp +++ b/engines/testbed/testbed.cpp @@ -88,14 +88,15 @@ TestbedEngine::~TestbedEngine() { } } -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 @@ Common::Error TestbedEngine::run() { return Common::kNoError; } - invokeTestsuites(); + invokeTestsuites(cfMan); return Common::kNoError; } diff --git a/engines/testbed/testbed.h b/engines/testbed/testbed.h index bee918cc57..a13249fe49 100644 --- a/engines/testbed/testbed.h +++ b/engines/testbed/testbed.h @@ -33,6 +33,8 @@ namespace Testbed { +class TestbedConfigManager; + enum { kTestbedLogOutput = 1 << 0, kTestbedEngineDebug = 1 << 2 @@ -48,7 +50,7 @@ public: /** * Invokes configured testsuites. */ - void invokeTestsuites(); + void invokeTestsuites(TestbedConfigManager &cfMan); bool hasFeature(EngineFeature f) const; diff --git a/engines/testbed/testsuite.cpp b/engines/testbed/testsuite.cpp index 22f931bed5..fe407f32f2 100644 --- a/engines/testbed/testsuite.cpp +++ b/engines/testbed/testsuite.cpp @@ -219,6 +219,17 @@ void Testsuite::addTest(const Common::String &name, InvokingFunction f, bool isI _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 @@ bool Testsuite::enableTest(const Common::String &testName, bool toEnable) { return false; } + void Testsuite::execute() { // Main Loop for a testsuite @@ -299,6 +311,7 @@ void Testsuite::execute() { 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 @@ void Testsuite::execute() { } 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 @@ void Testsuite::execute() { } 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 diff --git a/engines/testbed/testsuite.h b/engines/testbed/testsuite.h index e19cfe1896..b4357e1f1e 100644 --- a/engines/testbed/testsuite.h +++ b/engines/testbed/testsuite.h @@ -171,7 +171,7 @@ public: 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 |