diff options
author | Neeraj Kumar | 2010-08-01 23:26:38 +0000 |
---|---|---|
committer | Neeraj Kumar | 2010-08-01 23:26:38 +0000 |
commit | 717e5f619b6a383cc96cbcd1d87f2584e0a89463 (patch) | |
tree | cdecebe60784125e9a48f15fd1ff447dfe867318 /engines/testbed | |
parent | d628562071cc8dd8475e0dd2bdf43601fdecb888 (diff) | |
download | scummvm-rg350-717e5f619b6a383cc96cbcd1d87f2584e0a89463.tar.gz scummvm-rg350-717e5f619b6a383cc96cbcd1d87f2584e0a89463.tar.bz2 scummvm-rg350-717e5f619b6a383cc96cbcd1d87f2584e0a89463.zip |
TESTBED: implemented the exit dialog using ListWidget
svn-id: r51602
Diffstat (limited to 'engines/testbed')
-rw-r--r-- | engines/testbed/config.cpp | 13 | ||||
-rw-r--r-- | engines/testbed/config.h | 4 | ||||
-rw-r--r-- | engines/testbed/testbed.cpp | 28 | ||||
-rw-r--r-- | engines/testbed/testbed.h | 5 | ||||
-rw-r--r-- | engines/testbed/testsuite.cpp | 5 | ||||
-rw-r--r-- | engines/testbed/testsuite.h | 2 |
6 files changed, 47 insertions, 10 deletions
diff --git a/engines/testbed/config.cpp b/engines/testbed/config.cpp index ff7797641a..ae52b136d7 100644 --- a/engines/testbed/config.cpp +++ b/engines/testbed/config.cpp @@ -145,6 +145,19 @@ void TestbedInteractionDialog::addButton(uint w, uint h, const Common::String na _yOffset += h; } +void TestbedInteractionDialog::addList(uint x, uint y, uint w, uint h, Common::Array<Common::String> &strArray, uint yPadding) { + _yOffset += yPadding; + GUI::ListWidget *list = new GUI::ListWidget(this, x, y, w, h); + list->setEditable(false); + list->setNumberingMode(GUI::kListNumberingOff); + list->setList(strArray); + _yOffset += h; +} + +void TestbedInteractionDialog::addButtonXY(uint x, uint y, uint w, uint h, const Common::String name, uint32 cmd) { + _buttonArray.push_back(new GUI::ButtonWidget(this, x, _yOffset, w, h, name, cmd)); +} + void TestbedInteractionDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) { switch (cmd) { default: diff --git a/engines/testbed/config.h b/engines/testbed/config.h index 224954d44e..37344ea9e6 100644 --- a/engines/testbed/config.h +++ b/engines/testbed/config.h @@ -121,7 +121,9 @@ public: protected: virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); void addButton(uint w, uint h, const Common::String name, uint32 cmd, uint xOffset = 0, uint yPadding = 8); - void addText(uint w, uint h, const Common::String text, Graphics::TextAlign textAlign, uint xOffset, uint yPadding); + void addButtonXY(uint x, uint y, uint w, uint h, const Common::String name, uint32 cmd); + void addText(uint w, uint h, const Common::String text, Graphics::TextAlign textAlign, uint xOffset, uint yPadding = 8); + void addList(uint x, uint y, uint w, uint h, Common::Array<Common::String> &strArray, uint yPadding = 8); Common::Array<GUI::ButtonWidget *> _buttonArray; uint _xOffset; uint _yOffset; diff --git a/engines/testbed/testbed.cpp b/engines/testbed/testbed.cpp index f75785c74e..ef61cd7c13 100644 --- a/engines/testbed/testbed.cpp +++ b/engines/testbed/testbed.cpp @@ -38,14 +38,26 @@ namespace Testbed { -TestbedExitDialog::TestbedExitDialog() : TestbedInteractionDialog(80, 60, 400, 170), _rerun(false) { +void TestbedExitDialog::init() { _xOffset = 25; _yOffset = 0; - Common::String text = "Here we will have the results of all the tests!"; - addText(350, 20, text, Graphics::kTextAlignCenter, _xOffset, 15); - addButton(200, 20, "Rerun Tests", kCmdRerunTestbed); - addButton(50, 20, "Close", GUI::kCloseCmd, 160, 15); - + Common::String text = "Thank you for using ScummVM testbed! Here are yor summarized results:"; + addText(450, 20, text, Graphics::kTextAlignCenter, _xOffset, 15); + Common::Array<Common::String> strArray; + + for (Common::Array<Testsuite *>::const_iterator i = _testsuiteList.begin(); i != _testsuiteList.end(); ++i) { + strArray.push_back(Common::String::printf("%s (%d/%d tests failed)", (*i)->getName(), (*i)->getNumTestsFailed(), + (*i)->getNumTestsEnabled())); + } + + addList(0, _yOffset, 500, 200, strArray); + text = "More Details can be viewed in the Log file : " + Testsuite::getLogFile(); + addText(450, 20, text, Graphics::kTextAlignLeft, 0, 0); + text = "Directory : " + Testsuite::getLogDir(); + addText(500, 20, text, Graphics::kTextAlignLeft, 0, 0); + _yOffset += 5; + addButtonXY(_xOffset + 80, _yOffset, 120, 20, "Rerun Tests", kCmdRerunTestbed); + addButtonXY(_xOffset + 240, _yOffset, 60, 20, "Close", GUI::kCloseCmd); } void TestbedExitDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) { @@ -133,7 +145,7 @@ Common::Error TestbedEngine::run() { TestbedConfigManager cfMan(_testsuiteList, "testbed.config"); // Keep running if rerun requested - TestbedExitDialog tbDialog; + TestbedExitDialog tbDialog(_testsuiteList); do { Testsuite::clearEntireScreen(); @@ -146,7 +158,7 @@ Common::Error TestbedEngine::run() { } invokeTestsuites(cfMan); - + tbDialog.init(); tbDialog.run(); } while (tbDialog.rerunRequired()); diff --git a/engines/testbed/testbed.h b/engines/testbed/testbed.h index a880aa2ba1..3959865cfd 100644 --- a/engines/testbed/testbed.h +++ b/engines/testbed/testbed.h @@ -62,8 +62,10 @@ private: class TestbedExitDialog : public TestbedInteractionDialog { public: - TestbedExitDialog(); + TestbedExitDialog(Common::Array<Testsuite *> &testsuiteList) : TestbedInteractionDialog(80, 60, 500, 320), _rerun(false), + _testsuiteList(testsuiteList) {} ~TestbedExitDialog() {} + void init(); void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); void run() { runModal(); } bool rerunRequired() { @@ -75,6 +77,7 @@ public: } private: bool _rerun; + Common::Array<Testsuite *> &_testsuiteList; }; } // End of namespace Testbed diff --git a/engines/testbed/testsuite.cpp b/engines/testbed/testsuite.cpp index b11d780328..efd31c051d 100644 --- a/engines/testbed/testsuite.cpp +++ b/engines/testbed/testsuite.cpp @@ -231,6 +231,11 @@ void Testsuite::addTest(const Common::String &name, InvokingFunction f, bool isI int Testsuite::getNumTestsEnabled() { int count = 0; Common::Array<Test *>::const_iterator iter; + + if (!isEnabled()) { + return 0; + } + for (iter = _testsToExecute.begin(); iter != _testsToExecute.end(); iter++) { if ((*iter)->enabled) { count++; diff --git a/engines/testbed/testsuite.h b/engines/testbed/testsuite.h index aa47f0a8e7..bd05f36e87 100644 --- a/engines/testbed/testsuite.h +++ b/engines/testbed/testsuite.h @@ -143,6 +143,8 @@ public: static void initLogging(bool enable = true); static void setLogDir(const char *dirname); static void setLogFile(const char *filename); + static Common::String getLogDir() { return _logDirectory; } + static Common::String getLogFile() { return _logFilename; } static void deleteWriteStream(); |