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

sud03r at users.sourceforge.net sud03r at users.sourceforge.net
Wed Jun 2 15:56:04 CEST 2010


Revision: 49392
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49392&view=rev
Author:   sud03r
Date:     2010-06-02 13:56:04 +0000 (Wed, 02 Jun 2010)

Log Message:
-----------
completed the basic testsuite class

Modified Paths:
--------------
    scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp
    scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.h
    scummvm/branches/gsoc2010-testbed/engines/testbed/module.mk
    scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.cpp
    scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.h

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp	2010-06-02 13:17:36 UTC (rev 49391)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp	2010-06-02 13:56:04 UTC (rev 49392)
@@ -27,14 +27,29 @@
 		g_system->endGFXTransaction();
 	}
 
+	return true;
 }
 
 GFXTestSuite::GFXTestSuite() {
 	addTest("FullScreenMode", &testFullScreenMode);
 }
 
-int execute() {
-	//TODO: Implement the method	
+GFXTestSuite::~GFXTestSuite() {
+	printf("Cleanup\n");
 }
 
+const char *GFXTestSuite::getName() {
+	return "GFX";
 }
+
+int GFXTestSuite::execute() {
+	//TODO: Implement the method
+	for (Common::Array<Test*>::iterator i = _testsToExecute.begin(); i != _testsToExecute.end(); ++i) {
+		printf("Executing Test:%s\n", ((*i)->featureName).c_str());
+		printf("Result:%d",(*i)->driver());
+	}
+
+	return 1;
+}
+
+}

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.h
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.h	2010-06-02 13:17:36 UTC (rev 49391)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.h	2010-06-02 13:56:04 UTC (rev 49392)
@@ -1,4 +1,4 @@
-#ifdef GRAPHICS_H
+#ifndef GRAPHICS_H
 #define GRAPHICS_H
 
 #include "testbed/testsuite.h"
@@ -16,8 +16,10 @@
 	 * @see addTest()
 	 */
 	GFXTestSuite();
-	~GFXTestSuite() {};
-}
+	~GFXTestSuite();
+	int execute();
+	const char *getName(); 
+};
 
 }	// End of namespace Testbed
 

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/module.mk
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/module.mk	2010-06-02 13:17:36 UTC (rev 49391)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/module.mk	2010-06-02 13:56:04 UTC (rev 49392)
@@ -2,6 +2,7 @@
  
 MODULE_OBJS := \
 	detection.o \
+	graphics.o \
 	testbed.o
  
 MODULE_DIRS += \

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.cpp	2010-06-02 13:17:36 UTC (rev 49391)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.cpp	2010-06-02 13:56:04 UTC (rev 49392)
@@ -4,6 +4,7 @@
 #include "engines/util.h"
  
 #include "testbed/testbed.h"
+#include "testbed/graphics.h"
  
 namespace Testbed {
  
@@ -49,7 +50,9 @@
 	// Additional setup.
 	printf("TestbedEngine::init\n");
 
- 
+	GFXTestSuite ts;
+	ts.execute();
+
 	// Your main even loop should be (invoked from) here.
 	printf("TestbedEngine::go: Hello, World!\n");
 	

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.h
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.h	2010-06-02 13:17:36 UTC (rev 49391)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.h	2010-06-02 13:56:04 UTC (rev 49392)
@@ -10,20 +10,11 @@
 typedef bool (*invokingFunction)();
 
 /**
- * Make g_system available to test invoker functions
- */
-extern OSystem *g_system;
-
-/**
  * This represents a feature to be tested
  */
 
 struct Test {
-	Test(Common::String name, invokingFunction f) : featureName(name),
-													driver(f),
-													enabled(true),
-													passed(false) {}
-
+	Test(Common::String name, invokingFunction f) : featureName(name), driver(f), enabled(true), passed(false) {}
 	Common::String featureName;		///< Name of feature to be tested
 	invokingFunction driver;	    ///< Pointer to the function that will invoke this feature test
 	bool enabled;				    ///< Decides whether or not this test is to be executed
@@ -39,12 +30,11 @@
 class Testsuite {
 public:
 	Testsuite() {
-		extern OSystem *g_system;
 		_backend = g_system;
 		_numTestsPassed = 0;
 		_numTestsExecuted = 0;
 	}
-	~Testsuite() {}
+	virtual ~Testsuite() {}
 	inline int getNumTests() { return _testsToExecute.size(); }
 	inline int getNumTestsPassed() { return _numTestsPassed; }
 	inline int getNumTestsFailed() { return _numTestsExecuted - _numTestsPassed; }
@@ -56,7 +46,7 @@
 	 * @param	f pointer to the function that invokes this test
 	 */
 	inline void addTest(Common::String name, invokingFunction f) {
-		Test featureTest(name, f);
+		Test*  featureTest = new Test(name, f);
 		_testsToExecute.push_back(featureTest);
 	}
 	
@@ -68,12 +58,14 @@
 	virtual const char *getName() = 0;
 
 private:
-	OSystem		*_backend;					///< Pointer to OSystem backend
+	OSystem		*_backend;				///< Pointer to OSystem backend
 	int		    _numTestsPassed;			///< Number of tests passed
 	int  		_numTestsExecuted;			///< Number of tests executed
-	Common::Array<Test> _testsToExecute;	///< List of tests to be executed
-}
 
+protected:
+	Common::Array<Test*> _testsToExecute;			///< List of tests to be executed
+};
+
 }	// End of namespace testbed
 
 #endif


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