aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/testbed/config.cpp4
-rw-r--r--engines/testbed/config.h2
-rw-r--r--engines/testbed/events.cpp26
-rw-r--r--engines/testbed/events.h6
-rw-r--r--engines/testbed/fs.cpp28
-rw-r--r--engines/testbed/fs.h6
-rw-r--r--engines/testbed/graphics.cpp119
-rw-r--r--engines/testbed/graphics.h26
-rw-r--r--engines/testbed/misc.cpp24
-rw-r--r--engines/testbed/misc.h6
-rw-r--r--engines/testbed/savegame.cpp44
-rw-r--r--engines/testbed/savegame.h10
-rw-r--r--engines/testbed/sound.cpp41
-rw-r--r--engines/testbed/sound.h8
-rw-r--r--engines/testbed/testbed.cpp28
-rw-r--r--engines/testbed/testbed.h6
-rw-r--r--engines/testbed/testsuite.cpp22
-rw-r--r--engines/testbed/testsuite.h10
18 files changed, 226 insertions, 190 deletions
diff --git a/engines/testbed/config.cpp b/engines/testbed/config.cpp
index e8f7c71272..88272eda7e 100644
--- a/engines/testbed/config.cpp
+++ b/engines/testbed/config.cpp
@@ -151,12 +151,12 @@ void TestbedInteractionDialog::addButton(uint w, uint h, const Common::String na
_yOffset += h;
}
-void TestbedInteractionDialog::addList(uint x, uint y, uint w, uint h, Common::Array<Common::String> &strArray, uint yPadding) {
+void TestbedInteractionDialog::addList(uint x, uint y, uint w, uint h, Common::Array<Common::String> &strArray, GUI::ListWidget::ColorList *colors, uint yPadding) {
_yOffset += yPadding;
GUI::ListWidget *list = new GUI::ListWidget(this, x, y, w, h);
list->setEditable(false);
list->setNumberingMode(GUI::kListNumberingOff);
- list->setList(strArray);
+ list->setList(strArray, colors);
_yOffset += h;
}
diff --git a/engines/testbed/config.h b/engines/testbed/config.h
index 0c734c95fb..2e9669cf3b 100644
--- a/engines/testbed/config.h
+++ b/engines/testbed/config.h
@@ -122,7 +122,7 @@ public:
void addButton(uint w, uint h, const Common::String name, uint32 cmd, uint xOffset = 0, uint yPadding = 8);
void addButtonXY(uint x, uint y, uint w, uint h, const Common::String name, uint32 cmd);
void addText(uint w, uint h, const Common::String text, Graphics::TextAlign textAlign, uint xOffset, uint yPadding = 8);
- void addList(uint x, uint y, uint w, uint h, Common::Array<Common::String> &strArray, uint yPadding = 8);
+ void addList(uint x, uint y, uint w, uint h, Common::Array<Common::String> &strArray, GUI::ListWidget::ColorList *colors = 0, uint yPadding = 8);
protected:
Common::Array<GUI::ButtonWidget *> _buttonArray;
uint _xOffset;
diff --git a/engines/testbed/events.cpp b/engines/testbed/events.cpp
index a8e2816266..3858ef0e3a 100644
--- a/engines/testbed/events.cpp
+++ b/engines/testbed/events.cpp
@@ -116,7 +116,7 @@ Common::Rect EventTests::drawFinishZone() {
return Common::Rect(right - width, 0, right, height);
}
-bool EventTests::mouseEvents() {
+TestExitStatus EventTests::mouseEvents() {
Testsuite::clearScreen();
Common::String info = "Testing Mouse events.\n "
@@ -125,7 +125,7 @@ bool EventTests::mouseEvents() {
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : keyboard events\n");
- return true;
+ return kTestSkipped;
}
Common::EventManager *eventMan = g_system->getEventManager();
@@ -140,7 +140,7 @@ bool EventTests::mouseEvents() {
Common::Rect finishZone = drawFinishZone();
bool quitLoop = false;
- bool passed = true;
+ TestExitStatus passed = kTestPassed;
// handle all mouse events
Common::Event event;
while (!quitLoop) {
@@ -211,17 +211,17 @@ bool EventTests::mouseEvents() {
// Verify results now!
if (Testsuite::handleInteractiveInput("Were mouse clicks L/R/M buttons identfied?", "Yes", "No", kOptionRight)) {
Testsuite::logDetailedPrintf("Mouse clicks (L/R/M buttons) failed");
- passed = false;
+ passed = kTestFailed;
}
if (Testsuite::handleInteractiveInput("Were mouse wheel movements identified?", "Yes", "No", kOptionRight)) {
Testsuite::logDetailedPrintf("Mouse wheel movements failed");
- passed = false;
+ passed = kTestFailed;
}
return passed;
}
-bool EventTests::kbdEvents() {
+TestExitStatus EventTests::kbdEvents() {
Testsuite::clearScreen();
Common::String info = "Testing keyboard events.\n "
@@ -230,7 +230,7 @@ bool EventTests::kbdEvents() {
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : keyboard events\n");
- return true;
+ return kTestSkipped;
}
@@ -248,18 +248,18 @@ bool EventTests::kbdEvents() {
rect = Testsuite::writeOnScreen(text, pt);
}
- bool passed = true;
+ TestExitStatus passed = kTestPassed;
if (Testsuite::handleInteractiveInput("Was the word you entered same as that displayed on screen?", "Yes", "No", kOptionRight)) {
Testsuite::logDetailedPrintf("Keyboard Events failed");
- passed = false;
+ passed = kTestFailed;
}
Testsuite::clearScreen();
return passed;
}
-bool EventTests::showMainMenu() {
+TestExitStatus EventTests::showMainMenu() {
Testsuite::clearScreen();
Common::String info = "Testing Main Menu events.\n "
@@ -268,18 +268,18 @@ bool EventTests::showMainMenu() {
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : Main Menu\n");
- return true;
+ return kTestSkipped;
}
Common::EventManager *eventMan = g_system->getEventManager();
Common::Event mainMenuEvent;
mainMenuEvent.type = Common::EVENT_MAINMENU;
eventMan->pushEvent(mainMenuEvent);
- bool passed = true;
+ TestExitStatus passed = kTestPassed;
if (Testsuite::handleInteractiveInput("Were you able to see a main menu widget?", "Yes", "No", kOptionRight)) {
Testsuite::logDetailedPrintf("Event MAINMENU failed");
- passed = false;
+ passed = kTestFailed;
}
return passed;
diff --git a/engines/testbed/events.h b/engines/testbed/events.h
index e857deec25..607bba79d5 100644
--- a/engines/testbed/events.h
+++ b/engines/testbed/events.h
@@ -35,9 +35,9 @@ namespace EventTests {
char keystrokeToChar();
Common::Rect drawFinishZone();
// will contain function declarations for Event tests
-bool mouseEvents();
-bool kbdEvents();
-bool showMainMenu();
+TestExitStatus mouseEvents();
+TestExitStatus kbdEvents();
+TestExitStatus showMainMenu();
// add more here
} // End of namespace EventTests
diff --git a/engines/testbed/fs.cpp b/engines/testbed/fs.cpp
index ca255d547d..c98be8be12 100644
--- a/engines/testbed/fs.cpp
+++ b/engines/testbed/fs.cpp
@@ -63,14 +63,14 @@ bool FStests::readDataFromFile(Common::FSDirectory *directory, const char *file)
return true;
}
-bool FStests::testReadFile() {
+TestExitStatus FStests::testReadFile() {
const Common::String &path = ConfMan.get("path");
Common::FSDirectory gameRoot(path);
int numFailed = 0;
if (!gameRoot.getFSNode().exists() || !gameRoot.getFSNode().isDirectory()) {
Testsuite::logDetailedPrintf("game Path should be an existing directory");
- return false;
+ return kTestFailed;
}
const char *dirList[] = {"test1" ,"Test2", "TEST3" , "tEST4", "test5"};
@@ -83,7 +83,7 @@ bool FStests::testReadFile() {
if (!directory) {
Testsuite::logDetailedPrintf("Failed to open directory %s during FS tests\n", dirName.c_str());
- return false;
+ return kTestFailed;
}
if (!readDataFromFile(directory, fileName.c_str())) {
@@ -98,7 +98,7 @@ bool FStests::testReadFile() {
if (!directory) {
Testsuite::logDetailedPrintf("Failed to open directory %s during FS tests\n", dirName.c_str());
- return false;
+ return kTestFailed;
}
if (!readDataFromFile(directory, fileName.c_str())) {
@@ -113,7 +113,7 @@ bool FStests::testReadFile() {
if (!directory) {
Testsuite::logDetailedPrintf("Failed to open directory %s during FS tests\n", dirName.c_str());
- return false;
+ return kTestFailed;
}
if (!readDataFromFile(directory, fileName.c_str())) {
@@ -124,19 +124,23 @@ bool FStests::testReadFile() {
}
Testsuite::logDetailedPrintf("Failed %d out of 15\n", numFailed);
- return false;
+ if (numFailed) {
+ return kTestFailed;
+ } else {
+ return kTestPassed;
+ }
}
/**
* This test creates a file testbed.out, writes a sample data and confirms if
* it is same by reading the file again.
*/
-bool FStests::testWriteFile() {
+TestExitStatus FStests::testWriteFile() {
const Common::String &path = ConfMan.get("path");
Common::FSNode gameRoot(path);
if (!gameRoot.exists()) {
Testsuite::logPrintf("Couldn't open the game data directory %s", path.c_str());
- return false;
+ return kTestFailed;
}
Common::FSNode fileToWrite = gameRoot.getChild("testbed.out");
@@ -145,7 +149,7 @@ bool FStests::testWriteFile() {
if (!ws) {
Testsuite::logDetailedPrintf("Can't open writable file in game data dir\n");
- return false;
+ return kTestFailed;
}
ws->writeString("ScummVM Rocks!");
@@ -155,7 +159,7 @@ bool FStests::testWriteFile() {
Common::SeekableReadStream *rs = fileToWrite.createReadStream();
if (!rs) {
Testsuite::logDetailedPrintf("Can't open recently written file testbed.out in game data dir\n");
- return false;
+ return kTestFailed;
}
Common::String readFromFile = rs->readLine();
delete rs;
@@ -163,10 +167,10 @@ bool FStests::testWriteFile() {
if (readFromFile.equals("ScummVM Rocks!")) {
// All good
Testsuite::logDetailedPrintf("Data written and read correctly\n");
- return true;
+ return kTestPassed;
}
- return false;
+ return kTestFailed;
}
diff --git a/engines/testbed/fs.h b/engines/testbed/fs.h
index 9977369176..8670b0b4da 100644
--- a/engines/testbed/fs.h
+++ b/engines/testbed/fs.h
@@ -41,9 +41,9 @@ namespace FStests {
bool readDataFromFile(Common::FSDirectory *directory, const char *file);
// will contain function declarations for FS tests
-bool testReadFile();
-bool testWriteFile();
-bool testOpeningSaveFile();
+TestExitStatus testReadFile();
+TestExitStatus testWriteFile();
+TestExitStatus testOpeningSaveFile();
// add more here
} // End of namespace FStests
diff --git a/engines/testbed/graphics.cpp b/engines/testbed/graphics.cpp
index 38f5daf35d..22b453a763 100644
--- a/engines/testbed/graphics.cpp
+++ b/engines/testbed/graphics.cpp
@@ -397,7 +397,7 @@ void GFXtests::drawEllipse(int cx, int cy, int a, int b) {
/**
* Tests the fullscreen mode by: toggling between fullscreen and windowed mode
*/
-bool GFXtests::fullScreenMode() {
+TestExitStatus GFXtests::fullScreenMode() {
Testsuite::clearScreen();
Common::String info = "Fullscreen test. Here you should expect a toggle between windowed and fullscreen states depending "
"upon your initial state.";
@@ -407,12 +407,12 @@ bool GFXtests::fullScreenMode() {
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : FullScreenMode\n");
- return true;
+ return kTestSkipped;
}
bool isFeaturePresent;
bool isFeatureEnabled;
- bool passed = true;
+ TestExitStatus passed = kTestPassed;
Common::String prompt;
OptionSelected shouldSelect;
@@ -435,7 +435,7 @@ bool GFXtests::fullScreenMode() {
if (!Testsuite::handleInteractiveInput(prompt, "Fullscreen", "Windowed", shouldSelect)) {
// User selected incorrect current state
- passed = false;
+ passed = kTestFailed;
Testsuite::logDetailedPrintf("g_system->getFeatureState() failed\n");
}
@@ -453,7 +453,7 @@ bool GFXtests::fullScreenMode() {
if (!Testsuite::handleInteractiveInput(prompt, "Fullscreen", "Windowed", shouldSelect)) {
// User selected incorrect mode
- passed = false;
+ passed = kTestFailed;
Testsuite::logDetailedPrintf("g_system->setFeatureState() failed\n");
}
@@ -468,7 +468,7 @@ bool GFXtests::fullScreenMode() {
if (!Testsuite::handleInteractiveInput(prompt, "Yes, it is", "Nopes", shouldSelect)) {
// User selected incorrect mode
Testsuite::logDetailedPrintf("switching back to initial state failed\n");
- passed = false;
+ passed = kTestFailed;
}
} else {
@@ -481,7 +481,7 @@ bool GFXtests::fullScreenMode() {
/**
* Tests the aspect ratio correction by: drawing an ellipse, when corrected the ellipse should render to a circle
*/
-bool GFXtests::aspectRatio() {
+TestExitStatus GFXtests::aspectRatio() {
Testsuite::clearScreen();
Common::String info = "Aspect Ratio Correction test. If aspect ratio correction is enabled you should expect a circle on screen,"
@@ -489,14 +489,14 @@ bool GFXtests::aspectRatio() {
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : Aspect Ratio\n");
- return true;
+ return kTestSkipped;
}
// Draw an ellipse on the screen
drawEllipse(80, 160, 72, 60);
bool isFeaturePresent;
bool isFeatureEnabled;
- bool passed;
+ TestExitStatus passed = kTestPassed;
Common::String prompt;
OptionSelected shouldSelect;
@@ -510,7 +510,7 @@ bool GFXtests::aspectRatio() {
prompt = " What does the curve on screen appears to you ?";
if (!Testsuite::handleInteractiveInput(prompt, "Circle", "Ellipse", shouldSelect)) {
// User selected incorrect option
- passed = false;
+ passed = kTestFailed;
Testsuite::logDetailedPrintf("Aspect Ratio Correction failed\n");
}
@@ -524,7 +524,7 @@ bool GFXtests::aspectRatio() {
prompt = " What does the curve on screen appears to you ?";
if (!Testsuite::handleInteractiveInput(prompt, "Circle", "Ellipse", shouldSelect)) {
// User selected incorrect option
- passed = false;
+ passed = kTestFailed;
Testsuite::logDetailedPrintf("Aspect Ratio Correction failed\n");
}
@@ -540,7 +540,7 @@ bool GFXtests::aspectRatio() {
if (Testsuite::handleInteractiveInput("This should definetely be your initial state?", "Yes, it is", "Nopes", kOptionRight)) {
// User selected incorrect mode
Testsuite::logDetailedPrintf("Switching back to initial state failed\n");
- passed = false;
+ passed = kTestFailed;
}
return passed;
@@ -550,7 +550,7 @@ bool GFXtests::aspectRatio() {
* Tests Palettized cursors.
* Method: Create a yellow colored cursor, should be able to move it. Once you click test terminates
*/
-bool GFXtests::palettizedCursors() {
+TestExitStatus GFXtests::palettizedCursors() {
Testsuite::clearScreen();
Common::String info = "Palettized Cursors test.\n "
@@ -562,17 +562,17 @@ bool GFXtests::palettizedCursors() {
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : Palettized Cursors\n");
- return true;
+ return kTestSkipped;
}
- bool passed = true;
+ TestExitStatus passed = kTestPassed;
// Testing with cursor Palette
setupMouseLoop();
if (Testsuite::handleInteractiveInput("Which color did the cursor appeared to you?", "Yellow", "Any other", kOptionRight)) {
Testsuite::logDetailedPrintf("Couldn't use cursor palette for rendering cursor\n");
- passed = false;
+ passed = kTestFailed;
}
// Testing with game Palette
@@ -581,11 +581,11 @@ bool GFXtests::palettizedCursors() {
if (Testsuite::handleInteractiveInput("Which color did the cursor appeared to you?", "Red", "Any other", kOptionRight)) {
Testsuite::logDetailedPrintf("Couldn't use Game palette for rendering cursor\n");
- passed = false;
+ passed = kTestFailed;
}
if (!Testsuite::handleInteractiveInput("Did test run as was described?")) {
- passed = false;
+ passed = kTestFailed;
}
// re-enable cursor palette
@@ -599,7 +599,7 @@ bool GFXtests::palettizedCursors() {
* Tests automated mouse movements. "Warp" functionality provided by the backend.
*/
-bool GFXtests::mouseMovements() {
+TestExitStatus GFXtests::mouseMovements() {
Testsuite::clearScreen();
// Make mouse visible
CursorMan.showMouse(true);
@@ -610,7 +610,7 @@ bool GFXtests::mouseMovements() {
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : Mouse Movements\n");
- return true;
+ return kTestSkipped;
}
// Draw Rectangle
@@ -636,10 +636,10 @@ bool GFXtests::mouseMovements() {
CursorMan.showMouse(false);
if (Testsuite::handleInteractiveInput("Was the cursor symmetrically contained in the rectangle at (100, 100)?", "Yes", "No", kOptionRight)) {
- return false;
+ return kTestFailed;
}
- return true;
+ return kTestPassed;
}
@@ -648,7 +648,7 @@ bool GFXtests::mouseMovements() {
* This basically blits the screen by the contents of its buffer.
*
*/
-bool GFXtests::copyRectToScreen() {
+TestExitStatus GFXtests::copyRectToScreen() {
Testsuite::clearScreen();
Common::String info = "Testing Blitting a Bitmap to screen.\n"
@@ -656,7 +656,7 @@ bool GFXtests::copyRectToScreen() {
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : Blitting Bitmap\n");
- return true;
+ return kTestSkipped;
}
GFXTestSuite::setCustomColor(255, 255, 0);
@@ -671,17 +671,17 @@ bool GFXtests::copyRectToScreen() {
g_system->delayMillis(1000);
if (Testsuite::handleInteractiveInput("Did you see yellow rectangle?", "Yes", "No", kOptionRight)) {
- return false;
+ return kTestFailed;
}
- return true;
+ return kTestPassed;
}
/**
* Testing feature : Iconifying window
* It is expected the screen minimizes when this feature is enabled
*/
-bool GFXtests::iconifyWindow() {
+TestExitStatus GFXtests::iconifyWindow() {
Testsuite::clearScreen();
Common::String info = "Testing Iconify Window mode.\n If the feature is supported by the backend, "
@@ -689,7 +689,7 @@ bool GFXtests::iconifyWindow() {
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : Iconifying window\n");
- return true;
+ return kTestSkipped;
}
Common::Point pt(0, 100);
@@ -719,16 +719,16 @@ bool GFXtests::iconifyWindow() {
}
if (Testsuite::handleInteractiveInput("Did you see window minimized?", "Yes", "No", kOptionRight)) {
- return false;
+ return kTestFailed;
}
- return true;
+ return kTestPassed;
}
/**
* Testing feature: Scaled cursors
*/
-bool GFXtests::scaledCursors() {
+TestExitStatus GFXtests::scaledCursors() {
Testsuite::clearScreen();
Common::String info = "Testing : Scaled cursors\n"
@@ -738,7 +738,7 @@ bool GFXtests::scaledCursors() {
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : Scaled Cursors\n");
- return true;
+ return kTestSkipped;
}
int maxLimit = 1000;
@@ -771,7 +771,7 @@ bool GFXtests::scaledCursors() {
Testsuite::clearScreen();
} else {
Testsuite::logDetailedPrintf("Switching to graphics mode %s failed\n", gfxMode->name);
- return false;
+ return kTestFailed;
}
gfxMode++;
maxLimit--;
@@ -785,22 +785,22 @@ bool GFXtests::scaledCursors() {
if (gfxError != OSystem::kTransactionSuccess || !isGFXModeSet) {
Testsuite::logDetailedPrintf("Switcing to initial state failed\n");
- return false;
+ return kTestFailed;
}
// Done with cursors, Make them invisible, any other test may enable and use it.
CursorMan.showMouse(false);
- return true;
+ return kTestPassed;
}
-bool GFXtests::shakingEffect() {
+TestExitStatus GFXtests::shakingEffect() {
Testsuite::clearScreen();
Common::String info = "Shaking test. You should expect the graphics(text/bars etc) drawn on the screen to shake!";
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : Shaking Effect\n");
- return true;
+ return kTestSkipped;
}
Common::Point pt(0, 100);
@@ -816,12 +816,12 @@ bool GFXtests::shakingEffect() {
if (Testsuite::handleInteractiveInput("Did the Shaking test worked as you were expecting?", "Yes", "No", kOptionRight)) {
Testsuite::logDetailedPrintf("Shaking Effect didn't worked");
- return false;
+ return kTestFailed;
}
- return true;
+ return kTestPassed;
}
-bool GFXtests::focusRectangle() {
+TestExitStatus GFXtests::focusRectangle() {
Testsuite::clearScreen();
Common::String info = "Testing : Setting and hiding Focus \n"
@@ -829,7 +829,7 @@ bool GFXtests::focusRectangle() {
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : focus Rectangle\n");
- return true;
+ return kTestSkipped;
}
const Graphics::Font &font(*FontMan.getFontByUsage(Graphics::FontManager::kConsoleFont));
@@ -867,16 +867,16 @@ bool GFXtests::focusRectangle() {
Testsuite::logDetailedPrintf("Focus Rectangle feature doesn't works. Check platform.\n");
}
- return true;
+ return kTestPassed;
}
-bool GFXtests::overlayGraphics() {
+TestExitStatus GFXtests::overlayGraphics() {
Testsuite::clearScreen();
Common::String info = "Overlay Graphics. You should expect to see a green colored rectangle on the screen";
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : Overlay Graphics\n");
- return true;
+ return kTestSkipped;
}
Graphics::PixelFormat pf = g_system->getOverlayFormat();
@@ -899,13 +899,13 @@ bool GFXtests::overlayGraphics() {
if (Testsuite::handleInteractiveInput("Did you see a green overlayed rectangle?", "Yes", "No", kOptionRight)) {
Testsuite::logDetailedPrintf("Overlay Rectangle feature doesn't works\n");
- return false;
+ return kTestFailed;
}
- return true;
+ return kTestPassed;
}
-bool GFXtests::paletteRotation() {
+TestExitStatus GFXtests::paletteRotation() {
Common::String info = "Palette rotation. Here we draw a full 256 colored rainbow and then rotate it.\n"
"Note that the screen graphics change without having to draw anything.\n"
@@ -913,7 +913,7 @@ bool GFXtests::paletteRotation() {
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : palette Rotation\n");
- return true;
+ return kTestSkipped;
}
Common::Point pt(0, 10);
Testsuite::clearEntireScreen();
@@ -981,40 +981,40 @@ bool GFXtests::paletteRotation() {
Testsuite::clearScreen();
if(Testsuite::handleInteractiveInput("Did you saw a rotation in colors of rectangles displayed on screen?", "Yes", "No", kOptionRight)) {
- return false;
+ return kTestFailed;
}
- return true;
+ return kTestPassed;
}
-bool GFXtests::cursorTrails() {
+TestExitStatus GFXtests::cursorTrails() {
Common::String info = "With some shake offset the cursor was known to leave trails in the GUI\n"
"Here we set some offset and ask user to check for mouse trails, \n"
"the test is passed when there are no trails";
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : Cursor Trails\n");
- return true;
+ return kTestSkipped;
}
- bool passed = false;
+ TestExitStatus passed = kTestFailed;
g_system->setShakePos(25);
g_system->updateScreen();
if (Testsuite::handleInteractiveInput("Does the cursor leaves trails while moving?", "Yes", "No", kOptionRight)) {
- passed = true;
+ passed = kTestPassed;
}
g_system->setShakePos(0);
g_system->updateScreen();
return passed;
}
-bool GFXtests::pixelFormats() {
+TestExitStatus GFXtests::pixelFormats() {
Testsuite::clearScreen();
Common::String info = "Testing pixel formats. Here we iterate over all the supported pixel formats and display some colors using them\n"
"This may take long, especially if the backend supports many pixel formats";
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
- Testsuite::logPrintf("Info! Skipping test : focus Rectangle\n");
- return true;
+ Testsuite::logPrintf("Info! Skipping test : Pixel Formats\n");
+ return kTestSkipped;
}
Common::List<Graphics::PixelFormat> pfList = g_system->getSupportedFormats();
@@ -1055,7 +1055,6 @@ bool GFXtests::pixelFormats() {
Common::Point pt(0, 170);
Common::String msg;
- // XXX: Can use snprintf?
msg = Common::String::printf("Testing Pixel Formats, %d of %d", numFormatsTested, pfList.size());
Testsuite::writeOnScreen(msg, pt, true);
@@ -1093,10 +1092,10 @@ bool GFXtests::pixelFormats() {
if (numFailed) {
Testsuite::logDetailedPrintf("Pixel Format test: Failed : %d, Passed : %d, Ignored %d\n",numFailed, numPassed, numFormatsTested - (numPassed + numFailed));
- return false;
+ return kTestFailed;
}
- return true;
+ return kTestPassed;
}
} // End of namespace Testbed
diff --git a/engines/testbed/graphics.h b/engines/testbed/graphics.h
index 42ab5df59e..4ab4ba65ab 100644
--- a/engines/testbed/graphics.h
+++ b/engines/testbed/graphics.h
@@ -40,19 +40,19 @@ void HSVtoRGB(int &rComp, int &gComp, int &bComp, int hue, int sat, int val);
Common::Rect drawCursor(bool cursorPaletteDisabled = false, const char *gfxModeName = "", int cursorTargetScale = 1);
// will contain function declarations for GFX tests
-bool cursorTrails();
-bool fullScreenMode();
-bool aspectRatio();
-bool palettizedCursors();
-bool mouseMovements();
-bool copyRectToScreen();
-bool iconifyWindow();
-bool scaledCursors();
-bool shakingEffect();
-bool focusRectangle();
-bool overlayGraphics();
-bool paletteRotation();
-bool pixelFormats();
+TestExitStatus cursorTrails();
+TestExitStatus fullScreenMode();
+TestExitStatus aspectRatio();
+TestExitStatus palettizedCursors();
+TestExitStatus mouseMovements();
+TestExitStatus copyRectToScreen();
+TestExitStatus iconifyWindow();
+TestExitStatus scaledCursors();
+TestExitStatus shakingEffect();
+TestExitStatus focusRectangle();
+TestExitStatus overlayGraphics();
+TestExitStatus paletteRotation();
+TestExitStatus pixelFormats();
// add more here
} // End of namespace GFXtests
diff --git a/engines/testbed/misc.cpp b/engines/testbed/misc.cpp
index 74f0af2948..20813c4228 100644
--- a/engines/testbed/misc.cpp
+++ b/engines/testbed/misc.cpp
@@ -66,12 +66,12 @@ void MiscTests::criticalSection(void *arg) {
g_system->getTimerManager()->removeTimerProc(criticalSection);
}
-bool MiscTests::testDateTime() {
+TestExitStatus MiscTests::testDateTime() {
if (Testsuite::isSessionInteractive) {
if (Testsuite::handleInteractiveInput("Testing the date time API implementation", "Continue", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Date time tests skipped by the user.\n");
- return true;
+ return kTestSkipped;
}
Testsuite::writeOnScreen("Verifying Date-Time...", Common::Point(0, 100));
@@ -87,7 +87,7 @@ bool MiscTests::testDateTime() {
// Directly verify date
dateTimeNow = "We expect the current date time to be " + dateTimeNow;
if (Testsuite::handleInteractiveInput(dateTimeNow, "Correct!", "Wrong", kOptionRight)) {
- return false;
+ return kTestFailed;
}
}
@@ -105,32 +105,32 @@ bool MiscTests::testDateTime() {
if (t1.tm_mon == t2.tm_mon && t1.tm_year == t2.tm_year) {
// Ignore lag due to processing time
if (t1.tm_sec + 2 == t2.tm_sec) {
- return true;
+ return kTestPassed;
}
}
}
- return false;
+ return kTestFailed;
}
-bool MiscTests::testTimers() {
+TestExitStatus MiscTests::testTimers() {
static int valToModify = 0;
if (g_system->getTimerManager()->installTimerProc(timerCallback, 100000, &valToModify)) {
g_system->delayMillis(150);
g_system->getTimerManager()->removeTimerProc(timerCallback);
if (999 == valToModify) {
- return true;
+ return kTestPassed;
}
}
- return false;
+ return kTestFailed;
}
-bool MiscTests::testMutexes() {
+TestExitStatus MiscTests::testMutexes() {
if (Testsuite::isSessionInteractive) {
if (Testsuite::handleInteractiveInput("Testing the Mutual Exclusion API implementation", "Continue", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Mutex tests skipped by the user.\n");
- return true;
+ return kTestSkipped;
}
Testsuite::writeOnScreen("Installing mutex", Common::Point(0, 100));
}
@@ -157,10 +157,10 @@ bool MiscTests::testMutexes() {
g_system->deleteMutex(sv.mutex);
if (sv.resultSoFar && 6 == sv.second) {
- return true;
+ return kTestPassed;
}
- return false;
+ return kTestFailed;
}
MiscTestSuite::MiscTestSuite() {
diff --git a/engines/testbed/misc.h b/engines/testbed/misc.h
index 1ca01224e5..395955c7fe 100644
--- a/engines/testbed/misc.h
+++ b/engines/testbed/misc.h
@@ -48,9 +48,9 @@ void timerCallback(void *arg);
void criticalSection(void *arg);
// will contain function declarations for Misc tests
-bool testDateTime();
-bool testTimers();
-bool testMutexes();
+TestExitStatus testDateTime();
+TestExitStatus testTimers();
+TestExitStatus testMutexes();
// add more here
} // End of namespace MiscTests
diff --git a/engines/testbed/savegame.cpp b/engines/testbed/savegame.cpp
index 80c83725d2..b91d9fc47c 100644
--- a/engines/testbed/savegame.cpp
+++ b/engines/testbed/savegame.cpp
@@ -67,29 +67,29 @@ bool SaveGametests::readAndVerifyData(const char *fileName, const char *expected
return false;
}
-bool SaveGametests::testSaveLoadState() {
+TestExitStatus SaveGametests::testSaveLoadState() {
// create a savefile with "ScummVM Rocks!" written on it
if (!writeDataToFile("tBedSavefile.0", "ScummVM Rocks!")) {
Testsuite::logDetailedPrintf("Writing data to savefile failed\n");
- return false;
+ return kTestFailed;
}
// Verify if it contains the same data
if (!readAndVerifyData("tBedSavefile.0", "ScummVM Rocks!")) {
Testsuite::logDetailedPrintf("Reading data from savefile failed\n");
- return false;
+ return kTestFailed;
}
- return true;
+ return kTestPassed;
}
-bool SaveGametests::testRemovingSavefile() {
+TestExitStatus SaveGametests::testRemovingSavefile() {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
// Create a dummy savefile
if (!writeDataToFile("tBedSavefileToRemove.0", "Dummy Savefile!")) {
Testsuite::logDetailedPrintf("Writing data to savefile failed\n");
- return false;
+ return kTestFailed;
}
// Remove it
@@ -100,18 +100,18 @@ bool SaveGametests::testRemovingSavefile() {
if (loadFile) {
// Removing failed
Testsuite::logDetailedPrintf("Removing savefile failed\n");
- return false;
+ return kTestFailed;
}
- return true;
+ return kTestPassed;
}
-bool SaveGametests::testRenamingSavefile() {
+TestExitStatus SaveGametests::testRenamingSavefile() {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
// Open a file for renaming
if (!writeDataToFile("tBedSomeWeirdName.0", "Rename me!")) {
Testsuite::logDetailedPrintf("Writing data to savefile failed\n");
- return false;
+ return kTestFailed;
}
// Rename it
@@ -120,13 +120,13 @@ bool SaveGametests::testRenamingSavefile() {
// Verify if it contains the same data
if (!readAndVerifyData("tBedSomeCoolName.0", "Rename me!")) {
Testsuite::logDetailedPrintf("Renaming savefile failed\n");
- return false;
+ return kTestFailed;
}
- return true;
+ return kTestPassed;
}
-bool SaveGametests::testListingSavefile() {
+TestExitStatus SaveGametests::testListingSavefile() {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
saveFileMan->clearError();
@@ -141,7 +141,7 @@ bool SaveGametests::testListingSavefile() {
if (error != Common::kNoError) {
// Abort. Some Error in writing files
Testsuite::logDetailedPrintf("Error while creating savefiles: %s\n", Common::errorToString(error));
- return false;
+ return kTestFailed;
}
Common::StringArray savefileList = saveFileMan->listSavefiles("tBedSavefileToList.?");
@@ -156,20 +156,20 @@ bool SaveGametests::testListingSavefile() {
if (savefileList.size() == j) {
// A match for this name not found
Testsuite::logDetailedPrintf("Listed Names don't match\n");
- return false;
+ return kTestFailed;
}
}
}
- return true;
+ return kTestPassed;
} else {
Testsuite::logDetailedPrintf("listing Savefiles failed!\n");
- return false;
+ return kTestFailed;
}
- return false;
+ return kTestFailed;
}
-bool SaveGametests::testErrorMessages() {
+TestExitStatus SaveGametests::testErrorMessages() {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
saveFileMan->clearError();
@@ -180,12 +180,12 @@ bool SaveGametests::testErrorMessages() {
if (error == Common::kNoError) {
// blunder! how come?
Testsuite::logDetailedPrintf("SaveFileMan.getError() failed\n");
- return false;
+ return kTestFailed;
}
// Can't actually predict whether which error, kInvalidPath or kPathDoesNotExist or some other?
- // So just return true if some error
+ // So just return kTestPassed if some error
Testsuite::logDetailedPrintf("getError returned : %s\n", saveFileMan->getErrorDesc().c_str());
- return true;
+ return kTestPassed;
}
SaveGameTestSuite::SaveGameTestSuite() {
diff --git a/engines/testbed/savegame.h b/engines/testbed/savegame.h
index 98d630d237..dc41ff9b65 100644
--- a/engines/testbed/savegame.h
+++ b/engines/testbed/savegame.h
@@ -35,11 +35,11 @@ namespace SaveGametests {
bool writeDataToFile(const char *fileName, const char *msg);
bool readAndVerifyData(const char *fileName, const char *expected);
// will contain function declarations for SaveGame tests
-bool testSaveLoadState();
-bool testRemovingSavefile();
-bool testRenamingSavefile();
-bool testListingSavefile();
-bool testErrorMessages();
+TestExitStatus testSaveLoadState();
+TestExitStatus testRemovingSavefile();
+TestExitStatus testRenamingSavefile();
+TestExitStatus testListingSavefile();
+TestExitStatus testErrorMessages();
// add more here
} // End of namespace SaveGametests
diff --git a/engines/testbed/sound.cpp b/engines/testbed/sound.cpp
index 89aede7ef8..f93dbf0e92 100644
--- a/engines/testbed/sound.cpp
+++ b/engines/testbed/sound.cpp
@@ -110,15 +110,15 @@ void SoundSubsystemDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd,
}
}
-bool SoundSubsystem::playBeeps() {
+TestExitStatus SoundSubsystem::playBeeps() {
Testsuite::clearScreen();
- bool passed = true;
+ TestExitStatus passed = kTestPassed;
Common::String info = "Testing Sound Output by generating beeps\n"
"You should hear a left beep followed by a right beep\n";
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : Play Beeps\n");
- return true;
+ return kTestSkipped;
}
Audio::PCSpeaker *speaker = new Audio::PCSpeaker();
@@ -135,7 +135,7 @@ bool SoundSubsystem::playBeeps() {
if (Testsuite::handleInteractiveInput("Were you able to hear the left beep?", "Yes", "No", kOptionRight)) {
Testsuite::logDetailedPrintf("Error! Left Beep couldn't be detected : Error with Mixer::setChannelBalance()\n");
- passed = false;
+ passed = kTestFailed;
}
// Right Beep
@@ -147,41 +147,41 @@ bool SoundSubsystem::playBeeps() {
if (Testsuite::handleInteractiveInput("Were you able to hear the right beep?", "Yes", "No", kOptionRight)) {
Testsuite::logDetailedPrintf("Error! Right Beep couldn't be detected : Error with Mixer::setChannelBalance()\n");
- passed = false;
+ passed = kTestFailed;
}
return passed;
}
-bool SoundSubsystem::mixSounds() {
+TestExitStatus SoundSubsystem::mixSounds() {
Testsuite::clearScreen();
- bool passed = true;
+ TestExitStatus passed = kTestPassed;
Common::String info = "Testing Mixer Output by generating multichannel sound output using PC speaker emulator.\n"
"The mixer should be able to play them simultaneously\n";
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : Mix Sounds\n");
- return true;
+ return kTestSkipped;
}
SoundSubsystemDialog sDialog;
sDialog.runModal();
if (Testsuite::handleInteractiveInput("Was the mixer able to simultaneously play multiple channels?", "Yes", "No", kOptionRight)) {
Testsuite::logDetailedPrintf("Error! Multiple channels couldn't be played : Error with Mixer Class\n");
- passed = false;
+ passed = kTestFailed;
}
return passed;
}
-bool SoundSubsystem::audiocdOutput() {
+TestExitStatus SoundSubsystem::audiocdOutput() {
Testsuite::clearScreen();
- bool passed = true;
+ TestExitStatus passed = kTestPassed;
Common::String info = "Testing AudioCD API implementation.\n"
"Here we have four tracks, we play them in order i.e 1-2-3-last.\n"
"The user should verify if the tracks were run in correct order or not.";
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : AudioCD API\n");
- return true;
+ return kTestSkipped;
}
Common::Point pt(0, 100);
@@ -204,14 +204,23 @@ bool SoundSubsystem::audiocdOutput() {
Testsuite::clearScreen();
if (Testsuite::handleInteractiveInput("Were all the tracks played in order i.e 1-2-3-last ?", "Yes", "No", kOptionRight)) {
Testsuite::logPrintf("Error! Error in AudioCD.play() or probably sound files were not detected, try -d1 (debuglevel 1)\n");
- passed = false;
+ passed = kTestFailed;
}
return passed;
}
-bool SoundSubsystem::sampleRates() {
- bool passed = true;
+TestExitStatus SoundSubsystem::sampleRates() {
+
+ Common::String info = "Testing Multiple Sample Rates.\n"
+ "Here we try to play sounds at three different sample rates.";
+
+ if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
+ Testsuite::logPrintf("Info! Skipping test : Sample Rates\n");
+ return kTestSkipped;
+ }
+
+ TestExitStatus passed = kTestPassed;
Audio::Mixer *mixer = g_system->getMixer();
Audio::PCSpeaker *s1 = new Audio::PCSpeaker();
@@ -248,7 +257,7 @@ bool SoundSubsystem::sampleRates() {
Testsuite::clearScreen();
if (Testsuite::handleInteractiveInput("Was the mixer able to play beeps with variable sample rates?", "Yes", "No", kOptionRight)) {
Testsuite::logDetailedPrintf("Error! Error with variable sample rates\n");
- passed = false;
+ passed = kTestFailed;
}
return passed;
diff --git a/engines/testbed/sound.h b/engines/testbed/sound.h
index 53ff96cedb..ce8c5c3f33 100644
--- a/engines/testbed/sound.h
+++ b/engines/testbed/sound.h
@@ -46,10 +46,10 @@ namespace SoundSubsystem {
// Helper functions for SoundSubsystem tests
// will contain function declarations for SoundSubsystem tests
-bool playBeeps();
-bool mixSounds();
-bool audiocdOutput();
-bool sampleRates();
+TestExitStatus playBeeps();
+TestExitStatus mixSounds();
+TestExitStatus audiocdOutput();
+TestExitStatus sampleRates();
}
class SoundSubsystemTestSuite : public Testsuite {
diff --git a/engines/testbed/testbed.cpp b/engines/testbed/testbed.cpp
index ef61cd7c13..760213af4f 100644
--- a/engines/testbed/testbed.cpp
+++ b/engines/testbed/testbed.cpp
@@ -38,33 +38,43 @@
namespace Testbed {
+// Initialize static member for TestbedExitDialog
+bool TestbedExitDialog::_rerun = false;
+
void TestbedExitDialog::init() {
_xOffset = 25;
_yOffset = 0;
Common::String text = "Thank you for using ScummVM testbed! Here are yor summarized results:";
addText(450, 20, text, Graphics::kTextAlignCenter, _xOffset, 15);
Common::Array<Common::String> strArray;
+ GUI::ListWidget::ColorList colors;
for (Common::Array<Testsuite *>::const_iterator i = _testsuiteList.begin(); i != _testsuiteList.end(); ++i) {
- strArray.push_back(Common::String::printf("%s (%d/%d tests failed)", (*i)->getName(), (*i)->getNumTestsFailed(),
- (*i)->getNumTestsEnabled()));
+ strArray.push_back(Common::String::printf("%s :", (*i)->getDescription()));
+ colors.push_back(GUI::ThemeEngine::kFontColorNormal);
+ if ((*i)->isEnabled()) {
+ strArray.push_back(Common::String::printf("Passed: %d Failed: %d Skipped: %d", (*i)->getNumTestsPassed(), (*i)->getNumTestsFailed(), (*i)->getNumTestsSkipped()));
+ } else {
+ strArray.push_back("Skipped");
+ }
+ colors.push_back(GUI::ThemeEngine::kFontColorAlternate);
}
- addList(0, _yOffset, 500, 200, strArray);
+ addList(0, _yOffset, 500, 200, strArray, &colors);
text = "More Details can be viewed in the Log file : " + Testsuite::getLogFile();
addText(450, 20, text, Graphics::kTextAlignLeft, 0, 0);
text = "Directory : " + Testsuite::getLogDir();
addText(500, 20, text, Graphics::kTextAlignLeft, 0, 0);
_yOffset += 5;
- addButtonXY(_xOffset + 80, _yOffset, 120, 20, "Rerun Tests", kCmdRerunTestbed);
- addButtonXY(_xOffset + 240, _yOffset, 60, 20, "Close", GUI::kCloseCmd);
+ addButtonXY(_xOffset + 80, _yOffset, 120, 24, "Rerun test suite", kCmdRerunTestbed);
+ addButtonXY(_xOffset + 240, _yOffset, 60, 24, "Close", GUI::kCloseCmd);
}
void TestbedExitDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) {
switch (cmd) {
case kCmdRerunTestbed :
_rerun = true;
- GUI::Dialog::close();
+ cmd = GUI::kCloseCmd;
default:
GUI::Dialog::handleCommand(sender, cmd, data);
}
@@ -144,8 +154,7 @@ Common::Error TestbedEngine::run() {
TestbedConfigManager cfMan(_testsuiteList, "testbed.config");
- // Keep running if rerun requested
- TestbedExitDialog tbDialog(_testsuiteList);
+ // Keep running if rerun requested
do {
Testsuite::clearEntireScreen();
@@ -158,10 +167,11 @@ Common::Error TestbedEngine::run() {
}
invokeTestsuites(cfMan);
+ TestbedExitDialog tbDialog(_testsuiteList);
tbDialog.init();
tbDialog.run();
- } while (tbDialog.rerunRequired());
+ } while (TestbedExitDialog::rerunRequired());
return Common::kNoError;
}
diff --git a/engines/testbed/testbed.h b/engines/testbed/testbed.h
index 3959865cfd..1ae0c3563c 100644
--- a/engines/testbed/testbed.h
+++ b/engines/testbed/testbed.h
@@ -62,13 +62,13 @@ private:
class TestbedExitDialog : public TestbedInteractionDialog {
public:
- TestbedExitDialog(Common::Array<Testsuite *> &testsuiteList) : TestbedInteractionDialog(80, 60, 500, 320), _rerun(false),
+ TestbedExitDialog(Common::Array<Testsuite *> &testsuiteList) : TestbedInteractionDialog(80, 40, 500, 330),
_testsuiteList(testsuiteList) {}
~TestbedExitDialog() {}
void init();
void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
void run() { runModal(); }
- bool rerunRequired() {
+ static bool rerunRequired() {
if (_rerun) {
_rerun = false;
return true;
@@ -76,7 +76,7 @@ public:
return false;
}
private:
- bool _rerun;
+ static bool _rerun;
Common::Array<Testsuite *> &_testsuiteList;
};
diff --git a/engines/testbed/testsuite.cpp b/engines/testbed/testsuite.cpp
index 76d9049a39..3f98938e75 100644
--- a/engines/testbed/testsuite.cpp
+++ b/engines/testbed/testsuite.cpp
@@ -121,6 +121,7 @@ void Testsuite::logDetailedPrintf(const char *fmt, ...) {
Testsuite::Testsuite() {
_numTestsPassed = 0;
_numTestsExecuted = 0;
+ _numTestsSkipped = 0;
// Initially all testsuites are enabled, disable them by calling enableTestSuite(name, false)
_isTsEnabled = true;
// Set custom color for progress bar
@@ -148,6 +149,7 @@ void Testsuite::genReport() const {
logPrintf("Subsystem: %s ", getName());
logPrintf("(Tests Executed: %d)\n", _numTestsExecuted);
logPrintf("Passed: %d ", _numTestsPassed);
+ logPrintf("Skipped: %d ", _numTestsSkipped);
logPrintf("Failed: %d\n", getNumTestsFailed());
logPrintf("\n");
}
@@ -333,29 +335,33 @@ void Testsuite::execute() {
for (Common::Array<Test *>::iterator i = _testsToExecute.begin(); i != _testsToExecute.end(); ++i) {
if (!(*i)->enabled) {
logPrintf("Info! Skipping Test: %s, Skipped by configuration.\n", ((*i)->featureName).c_str());
+ _numTestsSkipped++;
continue;
}
- if (toQuit == kSkipNext) {
- logPrintf("Info! Skipping Test: %s, Skipped by user.\n", ((*i)->featureName).c_str());
- toQuit = kLoopNormal;
- continue;
- }
-
if((*i)->isInteractive && !isSessionInteractive) {
logPrintf("Info! Skipping Test: %s, non-interactive environment is selected\n", ((*i)->featureName).c_str());
+ _numTestsSkipped++;
continue;
}
logPrintf("Info! Executing Test: %s\n", ((*i)->featureName).c_str());
updateStats("Test", ((*i)->featureName).c_str(), count++, numEnabledTests, pt);
- _numTestsExecuted++;
- if ((*i)->driver()) {
+
+ // Run the test and capture exit status.
+ TestExitStatus eStatus = (*i)->driver();
+ if (kTestPassed == eStatus) {
logPrintf("Result: Passed\n");
+ _numTestsExecuted++;
_numTestsPassed++;
+ } else if (kTestSkipped == eStatus){
+ logPrintf("Result: Skipped\n");
+ _numTestsSkipped++;
} else {
+ _numTestsExecuted++;
logPrintf("Result: Failed\n");
}
+
updateStats("Test", ((*i)->featureName).c_str(), count, numEnabledTests, pt);
// TODO: Display a screen here to user with details of upcoming test, he can skip it or Quit or RTL
// Check if user wants to quit/RTL/Skip next test by parsing events.
diff --git a/engines/testbed/testsuite.h b/engines/testbed/testsuite.h
index bd05f36e87..4a9843a06a 100644
--- a/engines/testbed/testsuite.h
+++ b/engines/testbed/testsuite.h
@@ -53,7 +53,13 @@ enum {
kEventHandlingTime = 50
};
-typedef bool (*InvokingFunction)();
+enum TestExitStatus {
+ kTestPassed = 0,
+ kTestSkipped,
+ kTestFailed
+};
+
+typedef TestExitStatus (*InvokingFunction)();
/**
* This represents a feature to be tested
@@ -85,6 +91,7 @@ public:
virtual ~Testsuite();
int getNumTests() const { return _testsToExecute.size(); }
int getNumTestsPassed() const { return _numTestsPassed; }
+ int getNumTestsSkipped() const { return _numTestsSkipped; }
int getNumTestsFailed() const { return _numTestsExecuted - _numTestsPassed; }
void genReport() const;
bool isEnabled() const { return _isTsEnabled; }
@@ -180,6 +187,7 @@ protected:
Common::Array<Test *> _testsToExecute; ///< List of tests to be executed
int _numTestsPassed; ///< Number of tests passed
int _numTestsExecuted; ///< Number of tests executed
+ int _numTestsSkipped;
bool _isTsEnabled;
public: