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

sud03r at users.sourceforge.net sud03r at users.sourceforge.net
Wed Jun 2 06:45:44 CEST 2010


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

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

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

Added Paths:
-----------
    scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp

Added: scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp	                        (rev 0)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp	2010-06-02 04:45:44 UTC (rev 49390)
@@ -0,0 +1,40 @@
+#include "testbed/graphics.h"
+
+namespace Testbed {
+
+bool testFullScreenMode() {
+
+	printf("Testing fullscreen mode\n");
+	bool isFeaturePresent;
+	bool isFeatureEnabled;
+
+	isFeaturePresent = g_system->hasFeature(OSystem::kFeatureFullscreenMode);
+	isFeatureEnabled = g_system->getFeatureState(OSystem::kFeatureFullscreenMode);
+
+	printf("Testing Feature Presence.. \n");
+	if (isFeaturePresent) {
+		//Toggle
+		printf("Supported\n");
+
+		g_system->beginGFXTransaction();
+		g_system->setFeatureState(OSystem::kFeatureFullscreenMode, !isFeatureEnabled);
+		g_system->endGFXTransaction();
+
+		g_system->delayMillis(1000);
+		
+		g_system->beginGFXTransaction();
+		g_system->setFeatureState(OSystem::kFeatureFullscreenMode, isFeatureEnabled);
+		g_system->endGFXTransaction();
+	}
+
+}
+
+GFXTestSuite::GFXTestSuite() {
+	addTest("FullScreenMode", &testFullScreenMode);
+}
+
+int execute() {
+	//TODO: Implement the method	
+}
+
+}


Property changes on: scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.h
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.h	2010-06-02 02:55:55 UTC (rev 49389)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.h	2010-06-02 04:45:44 UTC (rev 49390)
@@ -1,8 +1,24 @@
 #ifdef GRAPHICS_H
 #define GRAPHICS_H
 
+#include "testbed/testsuite.h"
+
 namespace Testbed {
 
-class GFXTestsuite : Testsuite {
+class GFXTestSuite : public Testsuite {
 public:
-	
+	/**
+	 * The constructor for the GFXTestSuite
+	 * For every test to be executed one must:
+	 * 1) Create a function that would invoke the test
+	 * 2) Add that test to list by executing addTest()
+	 *
+	 * @see addTest()
+	 */
+	GFXTestSuite();
+	~GFXTestSuite() {};
+}
+
+}	// End of namespace Testbed
+
+#endif

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.cpp	2010-06-02 02:55:55 UTC (rev 49389)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.cpp	2010-06-02 04:45:44 UTC (rev 49390)
@@ -49,29 +49,6 @@
 	// Additional setup.
 	printf("TestbedEngine::init\n");
 
-	printf("Testing fullscreen mode\n");
-	bool isFeaturePresent;
-	bool isFeatureEnabled;
-
-	isFeaturePresent = _system->hasFeature(OSystem::kFeatureFullscreenMode);
-	isFeatureEnabled = _system->getFeatureState(OSystem::kFeatureFullscreenMode);
-
-	printf("Testing Feature Presence.. \n");
-	if (isFeaturePresent) {
-		//Toggle
-		printf("Supported\n");
-
-		_system->beginGFXTransaction();
-		_system->setFeatureState(OSystem::kFeatureFullscreenMode, !isFeatureEnabled);
-		_system->endGFXTransaction();
-
-		_system->delayMillis(1000);
-		
-		_system->beginGFXTransaction();
-		_system->setFeatureState(OSystem::kFeatureFullscreenMode, isFeatureEnabled);
-		_system->endGFXTransaction();
-	}
-
  
 	// 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 02:55:55 UTC (rev 49389)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.h	2010-06-02 04:45:44 UTC (rev 49390)
@@ -2,29 +2,35 @@
 #define TESTSUITE_H
 
 #include "common/system.h"
+#include "common/str.h"
+#include "common/array.h"
 
 namespace Testbed {
 
 typedef bool (*invokingFunction)();
 
 /**
- * This represents the a feature to be tested
- *
- * @Note
- * featureName stores the name of this feature test, for display purposes
- * driver is pointer to the function that will invoke this feature test
- * enabled	decides whether or not this test is to be executed
- * passed	collects and stores result of this feature test.
- *
+ * 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) {}
-	Common::String featureName;
-	invokingFunction driver;
-	bool enabled;
-	bool passed;
+	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
+	bool passed;					///< Collects and stores result of this feature test
 };
 
+
 /**
  * The basic Testsuite class
  * All the other testsuites would inherit it and override its virtual methods
@@ -35,22 +41,37 @@
 	Testsuite() {
 		extern OSystem *g_system;
 		_backend = g_system;
+		_numTestsPassed = 0;
+		_numTestsExecuted = 0;
 	}
 	~Testsuite() {}
-	inline int getNumTestsPassed() { return _numTestsPassed; };
-	inline int getNumTestsFailed() { return _numTestsExecuted - _numTestsPassed; };
+	inline int getNumTests() { return _testsToExecute.size(); }
+	inline int getNumTestsPassed() { return _numTestsPassed; }
+	inline int getNumTestsFailed() { return _numTestsExecuted - _numTestsPassed; }
+
+	/**
+	 * Adds a test to the list of tests to be executed
+	 *
+	 * @param	name the string description of the test, for display purposes
+	 * @param	f pointer to the function that invokes this test
+	 */
 	inline void addTest(Common::String name, invokingFunction f) {
 		Test featureTest(name, f);
 		_testsToExecute.push_back(featureTest);
 	}
+	
+	/**
+	 * The driver function for the testsuite
+	 * All code should go in here.
+	 */
 	virtual int execute() = 0;
 	virtual const char *getName() = 0;
 
 private:
-	OSystem		*_backend;
-	int		    _numTestsPassed;
-	int  		_numTestsExecuted;
-	Common::Array<Test> _testsToExecute; 
+	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
 }
 
 }	// End of namespace testbed


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