few fixes in GFX tests, added template for FS tests

svn-id: r49925
This commit is contained in:
Neeraj Kumar 2010-06-17 11:23:51 +00:00
parent 569caaf14e
commit f3dcd38c74
8 changed files with 125 additions and 37 deletions

12
engines/testbed/fs.cpp Normal file
View file

@ -0,0 +1,12 @@
#include "testbed/fs.h"
namespace Testbed {
FSTestSuite::FSTestSuite() {
}
const char *FSTestSuite::getName() const {
return "File System";
}
} // End of namespace Testbed

34
engines/testbed/fs.h Normal file
View file

@ -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

View file

@ -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();

View file

@ -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();

View file

@ -2,6 +2,7 @@ MODULE := engines/testbed
MODULE_OBJS := \
detection.o \
fs.o \
graphics.o \
testbed.o

View file

@ -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

View file

@ -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;
}

View file

@ -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());
}
/**