From 81a646c9bd32662f2a72fc0b3db32105857b9416 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Mon, 16 Aug 2010 22:04:15 +0000 Subject: TESTBED: added a README file, some description fixes svn-id: r52134 --- engines/testbed/README | 36 ++++++++++++++++++++++++++++++++++++ engines/testbed/graphics.cpp | 11 +++++++++-- 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 engines/testbed/README (limited to 'engines') diff --git a/engines/testbed/README b/engines/testbed/README new file mode 100644 index 0000000000..6feee10110 --- /dev/null +++ b/engines/testbed/README @@ -0,0 +1,36 @@ + +Testbed is a framework to test backend code. + +It implements a game-engine which invokes the backend code using the OSystem Interface, verifies +the behavior by interacting with the user, and then produce results. + +Each distinct interface defined in the OSystem API is referred as a Subsystem, namely: +* Graphics +* Audio +* Midi +* FileSyatem +* Savegames +* Events +* Timer/Mutexes + +There are testsuites for each one of these subsystems. + + +Adding a New Test +----------------- +If you are willing to add a test relating to one of these subsystems say 'Foo', then : +1). Modify the file 'foo.h' to include the declaration of your test-invoking function. +2). Define that function in 'foo.cpp' (similar to other tests). +3). Add the test to the subsystem testsuite by using addTest() method in the constructor. + + +Adding a New Testsuite +----------------------- +If you are willing to add a new Testsuite, create a copy of template.h. call it as say 'your_suite.h'. +Your Testsuite will be a subclass of Testsuite class deined in 'testsuite.h'. +Now write test-invoking functions for every test you want to include. +Add those tests to your_suite using the call to : 'addTest(name, InvokingFunction)'. + +Implement the required functions in 'your_test.cpp' +Add that file to module.mk. Re-Compile and run. + diff --git a/engines/testbed/graphics.cpp b/engines/testbed/graphics.cpp index b6a39295bd..bf82058dbc 100644 --- a/engines/testbed/graphics.cpp +++ b/engines/testbed/graphics.cpp @@ -601,7 +601,7 @@ TestExitStatus GFXtests::palettizedCursors() { TestExitStatus GFXtests::mouseMovements() { Testsuite::clearScreen(); - // Make mouse visible + // Ensure that the cursor is visible CursorMan.showMouse(true); Common::String info = "Testing Automated Mouse movements.\n" @@ -615,6 +615,8 @@ TestExitStatus GFXtests::mouseMovements() { // Draw Rectangle Graphics::Surface *screen = g_system->lockScreen(); + // Ensure that 2 represents red in current palette + GFXTestSuite::setCustomColor(255, 0, 0); screen->fillRect(Common::Rect::center(106, 106, 14, 14), 2); g_system->unlockScreen(); @@ -736,6 +738,12 @@ TestExitStatus GFXtests::scaledCursors() { "The expected cursor size is drawn as a rectangle.\n The cursor should approximately match that rectangle.\n" "This may take time, You may skip the later scalers and just examine the first three i.e 1x, 2x and 3x"; + bool isAspectRatioCorrected = g_system->getFeatureState(OSystem::kFeatureAspectRatioCorrection); + + if (isAspectRatioCorrected) { + info += "\nDisabling Aspect ratio correction, for letting cusors match exactly, will be restored after this test."; + } + if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) { Testsuite::logPrintf("Info! Skipping test : Scaled Cursors\n"); return kTestSkipped; @@ -746,7 +754,6 @@ TestExitStatus GFXtests::scaledCursors() { maxLimit = 3; } - bool isAspectRatioCorrected = g_system->getFeatureState(OSystem::kFeatureAspectRatioCorrection); if (isAspectRatioCorrected) { g_system->beginGFXTransaction(); -- cgit v1.2.3