diff options
author | Neeraj Kumar | 2010-06-02 13:56:04 +0000 |
---|---|---|
committer | Neeraj Kumar | 2010-06-02 13:56:04 +0000 |
commit | 91a8d25cea4eb44e55ac5e966b21c89bd044bc49 (patch) | |
tree | 71a50e3539402ec3c4fbad82c59fa92eb81a0696 | |
parent | 5df3809d371c1d37d03dfd51689a58420cc337a6 (diff) | |
download | scummvm-rg350-91a8d25cea4eb44e55ac5e966b21c89bd044bc49.tar.gz scummvm-rg350-91a8d25cea4eb44e55ac5e966b21c89bd044bc49.tar.bz2 scummvm-rg350-91a8d25cea4eb44e55ac5e966b21c89bd044bc49.zip |
completed the basic testsuite class
svn-id: r49392
-rw-r--r-- | engines/testbed/graphics.cpp | 19 | ||||
-rw-r--r-- | engines/testbed/graphics.h | 8 | ||||
-rw-r--r-- | engines/testbed/module.mk | 1 | ||||
-rw-r--r-- | engines/testbed/testbed.cpp | 5 | ||||
-rw-r--r-- | engines/testbed/testsuite.h | 24 |
5 files changed, 35 insertions, 22 deletions
diff --git a/engines/testbed/graphics.cpp b/engines/testbed/graphics.cpp index b8fcc40564..a2b6a8657b 100644 --- a/engines/testbed/graphics.cpp +++ b/engines/testbed/graphics.cpp @@ -27,14 +27,29 @@ bool testFullScreenMode() { 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; } } diff --git a/engines/testbed/graphics.h b/engines/testbed/graphics.h index db6a6a6d55..5afa765364 100644 --- a/engines/testbed/graphics.h +++ b/engines/testbed/graphics.h @@ -1,4 +1,4 @@ -#ifdef GRAPHICS_H +#ifndef GRAPHICS_H #define GRAPHICS_H #include "testbed/testsuite.h" @@ -16,8 +16,10 @@ public: * @see addTest() */ GFXTestSuite(); - ~GFXTestSuite() {}; -} + ~GFXTestSuite(); + int execute(); + const char *getName(); +}; } // End of namespace Testbed diff --git a/engines/testbed/module.mk b/engines/testbed/module.mk index 02d90fb12f..368b37b677 100644 --- a/engines/testbed/module.mk +++ b/engines/testbed/module.mk @@ -2,6 +2,7 @@ MODULE := engines/testbed MODULE_OBJS := \ detection.o \ + graphics.o \ testbed.o MODULE_DIRS += \ diff --git a/engines/testbed/testbed.cpp b/engines/testbed/testbed.cpp index 6af17c888e..6cf69dc176 100644 --- a/engines/testbed/testbed.cpp +++ b/engines/testbed/testbed.cpp @@ -4,6 +4,7 @@ #include "engines/util.h" #include "testbed/testbed.h" +#include "testbed/graphics.h" namespace Testbed { @@ -49,7 +50,9 @@ Common::Error TestbedEngine::run() { // 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"); diff --git a/engines/testbed/testsuite.h b/engines/testbed/testsuite.h index 3f968a6d21..4db898c1cd 100644 --- a/engines/testbed/testsuite.h +++ b/engines/testbed/testsuite.h @@ -10,20 +10,11 @@ namespace Testbed { 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 @@ struct Test { 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 @@ public: * @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,11 +58,13 @@ public: 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 |