aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorNeeraj Kumar2010-06-01 18:06:31 +0000
committerNeeraj Kumar2010-06-01 18:06:31 +0000
commitda1f5ee54c91cab0e8a7bf1523a7c8318ee63d1d (patch)
treead4b7b0915e23a3bc7ff4b3727e42cd41aa40fd0 /engines
parenta8a8ea31df50d8c6078cb95a949e84a58314d5b9 (diff)
downloadscummvm-rg350-da1f5ee54c91cab0e8a7bf1523a7c8318ee63d1d.tar.gz
scummvm-rg350-da1f5ee54c91cab0e8a7bf1523a7c8318ee63d1d.tar.bz2
scummvm-rg350-da1f5ee54c91cab0e8a7bf1523a7c8318ee63d1d.zip
created the basic testsuite class, will use it to create the GFX testsuite in graphics.h
svn-id: r49379
Diffstat (limited to 'engines')
-rw-r--r--engines/testbed/graphics.h8
-rw-r--r--engines/testbed/testbed.cpp24
-rw-r--r--engines/testbed/testsuite.h58
3 files changed, 89 insertions, 1 deletions
diff --git a/engines/testbed/graphics.h b/engines/testbed/graphics.h
new file mode 100644
index 0000000000..d10871fefe
--- /dev/null
+++ b/engines/testbed/graphics.h
@@ -0,0 +1,8 @@
+#ifdef GRAPHICS_H
+#define GRAPHICS_H
+
+namespace Testbed {
+
+class GFXTestsuite : Testsuite {
+public:
+
diff --git a/engines/testbed/testbed.cpp b/engines/testbed/testbed.cpp
index f941f0dab4..5c71c60a9e 100644
--- a/engines/testbed/testbed.cpp
+++ b/engines/testbed/testbed.cpp
@@ -49,7 +49,29 @@ Common::Error TestbedEngine::run() {
// Additional setup.
printf("TestbedEngine::init\n");
- printf("Height: %d\n",_system->getHeight());
+ 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");
diff --git a/engines/testbed/testsuite.h b/engines/testbed/testsuite.h
new file mode 100644
index 0000000000..fd36b1a953
--- /dev/null
+++ b/engines/testbed/testsuite.h
@@ -0,0 +1,58 @@
+#ifndef TESTSUITE_H
+#define TESTSUITE_H
+
+#include "common/system.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.
+ *
+ */
+struct Test {
+ Test(Common::String name, invokingFunction f) : featureName(name), driver(f) {}
+ Common::String featureName;
+ invokingFunction driver;
+ bool enabled;
+ bool passed;
+};
+
+/**
+ * The basic Testsuite class
+ * All the other testsuites would inherit it and override its virtual methods
+ */
+
+class Testsuite {
+public:
+ Testsuite() {
+ extern OSystem *g_system;
+ _backend = g_system;
+ }
+ ~Testsuite() {}
+ inline int getNumTestsPassed() { return _numTestsPassed; };
+ inline int getNumTestsFailed() { return _numTestsExecuted - _numTestsPassed; };
+ inline void addTest(Common::String name, invokingFunction f) {
+ Test featureTest(name, f);
+ _testsToExecute.push_back(featureTest);
+ }
+ virtual int execute() = 0;
+ virtual const char *getName() = 0;
+
+private:
+ OSystem *_backend;
+ int _numTestsPassed;
+ int _numTestsExecuted;
+ Common::Array<Test> _testsToExecute;
+}
+
+} // End of namespace testbed
+
+#endif