aboutsummaryrefslogtreecommitdiff
path: root/engines/testbed
diff options
context:
space:
mode:
Diffstat (limited to 'engines/testbed')
-rw-r--r--engines/testbed/fs.cpp12
-rw-r--r--engines/testbed/fs.h34
-rw-r--r--engines/testbed/graphics.cpp52
-rw-r--r--engines/testbed/graphics.h4
-rw-r--r--engines/testbed/module.mk1
-rw-r--r--engines/testbed/template.h36
-rw-r--r--engines/testbed/testbed.cpp15
-rw-r--r--engines/testbed/testsuite.h8
8 files changed, 125 insertions, 37 deletions
diff --git a/engines/testbed/fs.cpp b/engines/testbed/fs.cpp
new file mode 100644
index 0000000000..8428805cf8
--- /dev/null
+++ b/engines/testbed/fs.cpp
@@ -0,0 +1,12 @@
+#include "testbed/fs.h"
+
+namespace Testbed {
+
+FSTestSuite::FSTestSuite() {
+
+}
+const char *FSTestSuite::getName() const {
+ return "File System";
+}
+
+} // End of namespace Testbed
diff --git a/engines/testbed/fs.h b/engines/testbed/fs.h
new file mode 100644
index 0000000000..f602d984e5
--- /dev/null
+++ b/engines/testbed/fs.h
@@ -0,0 +1,34 @@
+#ifndef FS_H
+#define FS_H
+
+#include "testbed/testsuite.h"
+
+namespace Testbed {
+
+namespace FStests {
+
+// Helper functions for FS tests
+
+// will contain function declarations for FS tests
+// add more here
+}
+
+class FSTestSuite : public Testsuite {
+public:
+ /**
+ * The constructor for the FSTestSuite
+ * 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()
+ */
+ FSTestSuite();
+ ~FSTestSuite(){}
+ const char *getName() const;
+
+};
+
+} // End of namespace Testbed
+
+#endif
diff --git a/engines/testbed/graphics.cpp b/engines/testbed/graphics.cpp
index f79a8f98a1..3f9438d15c 100644
--- a/engines/testbed/graphics.cpp
+++ b/engines/testbed/graphics.cpp
@@ -22,21 +22,21 @@ GFXTestSuite::GFXTestSuite() {
// Add tests here
// Blitting buffer on screen
- // addTest("BlitBitmaps", &GFXtests::copyRectToScreen);
+ addTest("BlitBitmaps", &GFXtests::copyRectToScreen);
// GFX Transcations
- // addTest("FullScreenMode", &GFXtests::fullScreenMode);
- // addTest("AspectRatio", &GFXtests::aspectRatio);
- // addTest("IconifyingWindow", &GFXtests::iconifyWindow);
+ addTest("FullScreenMode", &GFXtests::fullScreenMode);
+ addTest("AspectRatio", &GFXtests::aspectRatio);
+ addTest("IconifyingWindow", &GFXtests::iconifyWindow);
// Mouse Layer tests (Palettes and movements)
addTest("PalettizedCursors", &GFXtests::palettizedCursors);
- // TODO: need to fix it
+ // FIXME: need to fix it
addTest("ScaledCursors", &GFXtests::scaledCursors);
// Effects
- // addTest("shakingEffect", &GFXtests::shakingEffect);
- // addTest("focusRectangle", &GFXtests::focusRectangle);
+ addTest("shakingEffect", &GFXtests::shakingEffect);
+ addTest("focusRectangle", &GFXtests::focusRectangle);
// TODO: unable to notice any change, make it noticable
addTest("Overlays", &GFXtests::overlayGraphics);
@@ -74,7 +74,7 @@ void GFXtests::drawCursor(bool cursorPaletteDisabled, const char *gfxModeName, i
buffer[10 - i][i] = 0;
}
- CursorMan.pushCursor(&buffer[0][0], 11, 11, 5, 5, 1);
+ CursorMan.pushCursor(&buffer[0][0], 11, 11, 5, 5, cursorTargetScale);
CursorMan.showMouse(true);
if (cursorPaletteDisabled) {
@@ -82,16 +82,6 @@ void GFXtests::drawCursor(bool cursorPaletteDisabled, const char *gfxModeName, i
}
g_system->updateScreen();
-
- if (gfxModeName) {
- Common::Point pt(0, 100);
- char scaleFactor[10];
- snprintf(scaleFactor, 10, "%dx", cursorTargetScale);
- Common::String info = "GFX Mode:";
- info = info + gfxModeName + " Cursor scaled by:" + scaleFactor;
- Testsuite::clearScreen();
- Testsuite::writeOnScreen(info, pt);
- }
}
/**
@@ -116,9 +106,21 @@ void GFXtests::setupMouseLoop(bool disableCursorPalette, const char *gfxModeName
Testsuite::clearScreen();
Common::String info = disableCursorPalette ? "Using Game Palette" : "Using cursor palette";
- info += "to render the cursor, Click to finish";
+ info += " to render the cursor, Click to finish";
Testsuite::writeOnScreen(info, pt);
+
+ info = "GFX Mode";
+ info += gfxModeName;
+ info += " ";
+
+ char cScale = cursorTargetScale + '0';
+ info += "Cursor scale: ";
+ info += cScale;
+
+ if (!Common::String(gfxModeName).equals("")) {
+ Testsuite::writeOnScreen(info, Common::Point(0, 120));
+ }
while (!quitLoop) {
while (eventMan->pollEvent(event)) {
@@ -133,13 +135,9 @@ void GFXtests::setupMouseLoop(bool disableCursorPalette, const char *gfxModeName
break;
case Common::EVENT_LBUTTONDOWN:
case Common::EVENT_RBUTTONDOWN:
- Testsuite::clearScreen();
- Testsuite::writeOnScreen("Mouse Clicked", pt);
- printf("Mouse Clicked\n");
- g_system->delayMillis(1000);
quitLoop = true;
Testsuite::clearScreen();
- Testsuite::writeOnScreen("TestFinished", pt);
+ Testsuite::writeOnScreen("Mouse clicked", pt);
g_system->delayMillis(1000);
break;
default:
@@ -505,7 +503,9 @@ bool GFXtests::scaledCursors() {
setupMouseLoop(false, gfxMode->name, 3);
unsetMouse();
-
+
+ break;
+
} else {
printf("Switching to graphics mode %s failed\n", gfxMode->name);
}
@@ -529,7 +529,7 @@ bool GFXtests::shakingEffect() {
g_system->delayMillis(1500);
if (Testsuite::handleInteractiveInput("Did the test worked as you were expecting?", "Yes", "No", kOptionRight)) {
- printf("LOG: Shaking Effect didn't worked");
+ printf("LOG: Shaking Effect didn't worked");
return false;
}
Testsuite::clearScreen();
diff --git a/engines/testbed/graphics.h b/engines/testbed/graphics.h
index 91cd605a4a..0d2d72d011 100644
--- a/engines/testbed/graphics.h
+++ b/engines/testbed/graphics.h
@@ -9,10 +9,10 @@ namespace GFXtests {
// Helper functions for GFX tests
void drawEllipse(int x, int y, int a, int b);
-void setupMouseLoop(bool disableCursorPalette = false, const char *gfxModeName = 0, int cursorTargetScale = 1);
+void setupMouseLoop(bool disableCursorPalette = false, const char *gfxModeName = "", int cursorTargetScale = 1);
void unsetMouse();
void mouseMovements();
-void drawCursor(bool cursorPaletteDisabled = false, const char *gfxModeName = 0, int cursorTargetScale = 1);
+void drawCursor(bool cursorPaletteDisabled = false, const char *gfxModeName = "", int cursorTargetScale = 1);
// will contain function declarations for GFX tests
bool fullScreenMode();
diff --git a/engines/testbed/module.mk b/engines/testbed/module.mk
index 368b37b677..ab24d3ad37 100644
--- a/engines/testbed/module.mk
+++ b/engines/testbed/module.mk
@@ -2,6 +2,7 @@ MODULE := engines/testbed
MODULE_OBJS := \
detection.o \
+ fs.o \
graphics.o \
testbed.o
diff --git a/engines/testbed/template.h b/engines/testbed/template.h
new file mode 100644
index 0000000000..3c7d498908
--- /dev/null
+++ b/engines/testbed/template.h
@@ -0,0 +1,36 @@
+#ifndef TEMPLATE_H
+#define TEMPLATE_H
+
+#include "testbed/testsuite.h"
+
+// This file can be used as template for header files of other newer testsuites.
+
+namespace Testbed {
+
+namespace XXXtests {
+
+// Helper functions for XXX tests
+
+// will contain function declarations for XXX tests
+// add more here
+}
+
+class XXXTestSuite : public Testsuite {
+public:
+ /**
+ * The constructor for the XXXTestSuite
+ * 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()
+ */
+ XXXTestSuite();
+ ~XXXTestSuite(){}
+ const char *getName() const;
+
+};
+
+} // End of namespace Testbed
+
+#endif
diff --git a/engines/testbed/testbed.cpp b/engines/testbed/testbed.cpp
index fb70acb9df..789fe7c2ec 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/fs.h"
#include "testbed/graphics.h"
namespace Testbed {
@@ -60,16 +61,20 @@ Common::Error TestbedEngine::run() {
"If you see this, it means interactive tests would run on this system :)");
// To be set from config file
- interactive = true;
- Testsuite::displayMessage(prompt, "proceed?");
+ // XXX: disabling these as of now for fastly testing other tests
+ interactive = false;
if (interactive) {
- printf("Running tests in Interactive Mode\n");
+ printf("Running Interactive tests as well\n");
+ Testsuite::displayMessage(prompt, "proceed?");
// Executing GFX Tests
- GFXTestSuite ts;
- ts.execute();
+ GFXTestSuite gts;
+ gts.execute();
}
+ FSTestSuite fts;
+ fts.execute();
+
return Common::kNoError;
}
diff --git a/engines/testbed/testsuite.h b/engines/testbed/testsuite.h
index 3f7da993a8..abcb9e1d6f 100644
--- a/engines/testbed/testsuite.h
+++ b/engines/testbed/testsuite.h
@@ -60,10 +60,10 @@ public:
int getNumTestsPassed() const { return _numTestsPassed; }
int getNumTestsFailed() const { return _numTestsExecuted - _numTestsPassed; }
void genReport() const {
- printf("Subsystem:%s\n",getName());
- printf("Tests executed:%d\n", _numTestsExecuted);
- printf("Tests Passed:%d\n", _numTestsPassed);
- printf("Tests Failed:%d\n", getNumTestsFailed());
+ printf("\nSubsystem: %s\n",getName());
+ printf("Tests executed: %d\n", _numTestsExecuted);
+ printf("Tests Passed: %d\n", _numTestsPassed);
+ printf("Tests Failed: %d\n\n", getNumTestsFailed());
}
/**