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

sud03r at users.sourceforge.net sud03r at users.sourceforge.net
Mon Aug 2 01:26:39 CEST 2010


Revision: 51602
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51602&view=rev
Author:   sud03r
Date:     2010-08-01 23:26:38 +0000 (Sun, 01 Aug 2010)

Log Message:
-----------
TESTBED: implemented the exit dialog using ListWidget

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-08-01 22:59:58 UTC (rev 51601)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/config.cpp	2010-08-01 23:26:38 UTC (rev 51602)
@@ -145,6 +145,19 @@
 	_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:

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/config.h
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/config.h	2010-08-01 22:59:58 UTC (rev 51601)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/config.h	2010-08-01 23:26:38 UTC (rev 51602)
@@ -121,7 +121,9 @@
 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;

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.cpp	2010-08-01 22:59:58 UTC (rev 51601)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.cpp	2010-08-01 23:26:38 UTC (rev 51602)
@@ -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 @@
 	TestbedConfigManager cfMan(_testsuiteList, "testbed.config");
 	
 	// Keep running if rerun requested 
-	TestbedExitDialog tbDialog;
+	TestbedExitDialog tbDialog(_testsuiteList);
 
 	do {
 		Testsuite::clearEntireScreen();
@@ -146,7 +158,7 @@
 		}
 		
 		invokeTestsuites(cfMan);
-		
+		tbDialog.init();
 		tbDialog.run();
 
 	} while (tbDialog.rerunRequired());

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.h
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.h	2010-08-01 22:59:58 UTC (rev 51601)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.h	2010-08-01 23:26:38 UTC (rev 51602)
@@ -62,8 +62,10 @@
 
 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 @@
 	}
 private:
 	bool _rerun;
+	Common::Array<Testsuite *> &_testsuiteList;
 };
 
 } // End of namespace Testbed

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.cpp	2010-08-01 22:59:58 UTC (rev 51601)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.cpp	2010-08-01 23:26:38 UTC (rev 51602)
@@ -231,6 +231,11 @@
 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++;

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.h
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.h	2010-08-01 22:59:58 UTC (rev 51601)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.h	2010-08-01 23:26:38 UTC (rev 51602)
@@ -143,6 +143,8 @@
 	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();
 


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