From 555acf4ba17898c0192c262f9dae45ab43a47185 Mon Sep 17 00:00:00 2001 From: Jordi Vilalta Prat Date: Wed, 14 Jul 2010 19:44:51 +0000 Subject: Some code formatting fixes svn-id: r50893 --- engines/testbed/events.cpp | 64 +++++++++++------------ engines/testbed/events.h | 11 ++-- engines/testbed/fs.cpp | 6 +-- engines/testbed/fs.h | 9 ++-- engines/testbed/graphics.cpp | 118 ++++++++++++++++-------------------------- engines/testbed/graphics.h | 11 ++-- engines/testbed/misc.cpp | 7 ++- engines/testbed/misc.h | 10 ++-- engines/testbed/savegame.cpp | 10 +--- engines/testbed/savegame.h | 10 ++-- engines/testbed/template.h | 9 ++-- engines/testbed/testbed.cpp | 8 +-- engines/testbed/testbed.h | 2 +- engines/testbed/testsuite.cpp | 27 +++++----- engines/testbed/testsuite.h | 6 +-- 15 files changed, 138 insertions(+), 170 deletions(-) (limited to 'engines') diff --git a/engines/testbed/events.cpp b/engines/testbed/events.cpp index 9facc200db..10ee870e73 100644 --- a/engines/testbed/events.cpp +++ b/engines/testbed/events.cpp @@ -38,34 +38,34 @@ struct keycodeToChar { Common::KeyCode code; char value; } keyCodeLUT[] = { - {Common::KEYCODE_a, 'a'}, - {Common::KEYCODE_b, 'b'}, - {Common::KEYCODE_c, 'c'}, - {Common::KEYCODE_d, 'd'}, - {Common::KEYCODE_e, 'e'}, - {Common::KEYCODE_f, 'f'}, - {Common::KEYCODE_g, 'g'}, - {Common::KEYCODE_h, 'h'}, - {Common::KEYCODE_i, 'i'}, - {Common::KEYCODE_j, 'j'}, - {Common::KEYCODE_k, 'k'}, - {Common::KEYCODE_l, 'l'}, - {Common::KEYCODE_m, 'm'}, - {Common::KEYCODE_n, 'n'}, - {Common::KEYCODE_o, 'o'}, - {Common::KEYCODE_p, 'p'}, - {Common::KEYCODE_q, 'q'}, - {Common::KEYCODE_r, 'r'}, - {Common::KEYCODE_s, 's'}, - {Common::KEYCODE_t, 't'}, - {Common::KEYCODE_u, 'u'}, - {Common::KEYCODE_v, 'v'}, - {Common::KEYCODE_w, 'w'}, - {Common::KEYCODE_x, 'x'}, - {Common::KEYCODE_y, 'y'}, - {Common::KEYCODE_z, 'z'}, - {Common::KEYCODE_SPACE, ' '} - }; + {Common::KEYCODE_a, 'a'}, + {Common::KEYCODE_b, 'b'}, + {Common::KEYCODE_c, 'c'}, + {Common::KEYCODE_d, 'd'}, + {Common::KEYCODE_e, 'e'}, + {Common::KEYCODE_f, 'f'}, + {Common::KEYCODE_g, 'g'}, + {Common::KEYCODE_h, 'h'}, + {Common::KEYCODE_i, 'i'}, + {Common::KEYCODE_j, 'j'}, + {Common::KEYCODE_k, 'k'}, + {Common::KEYCODE_l, 'l'}, + {Common::KEYCODE_m, 'm'}, + {Common::KEYCODE_n, 'n'}, + {Common::KEYCODE_o, 'o'}, + {Common::KEYCODE_p, 'p'}, + {Common::KEYCODE_q, 'q'}, + {Common::KEYCODE_r, 'r'}, + {Common::KEYCODE_s, 's'}, + {Common::KEYCODE_t, 't'}, + {Common::KEYCODE_u, 'u'}, + {Common::KEYCODE_v, 'v'}, + {Common::KEYCODE_w, 'w'}, + {Common::KEYCODE_x, 'x'}, + {Common::KEYCODE_y, 'y'}, + {Common::KEYCODE_z, 'z'}, + {Common::KEYCODE_SPACE, ' '} +}; char EventTests::keystrokeToChar() { Common::EventManager *eventMan = g_system->getEventManager(); @@ -75,15 +75,13 @@ char EventTests::keystrokeToChar() { // handle all keybd events while (!quitLoop) { while (eventMan->pollEvent(event)) { - // Quit if explicitly requested! if (Engine::shouldQuit()) { return 0; } switch (event.type) { - case Common::EVENT_KEYDOWN : - + case Common::EVENT_KEYDOWN: if (event.kbd.keycode == Common::KEYCODE_ESCAPE) { return 0; } @@ -170,9 +168,8 @@ bool EventTests::mouseEvents() { quitLoop = true; } break; - default: - break; + break; } } @@ -240,6 +237,7 @@ EventTestSuite::EventTestSuite() { addTest("Keyboard Events", &EventTests::kbdEvents); addTest("Mainmenu Event", &EventTests::showMainMenu); } + const char *EventTestSuite::getName() const { return "Events"; } diff --git a/engines/testbed/events.h b/engines/testbed/events.h index 3effb2c260..187fa5a183 100644 --- a/engines/testbed/events.h +++ b/engines/testbed/events.h @@ -27,7 +27,6 @@ #include "testbed/testsuite.h" - namespace Testbed { namespace EventTests { @@ -39,7 +38,8 @@ bool mouseEvents(); bool kbdEvents(); bool showMainMenu(); // add more here -} + +} // End of namespace EventTests class EventTestSuite : public Testsuite { public: @@ -52,11 +52,10 @@ public: * @see addTest() */ EventTestSuite(); - ~EventTestSuite(){} + ~EventTestSuite() {} const char *getName() const; - }; -} // End of namespace Testbed +} // End of namespace Testbed -#endif +#endif // TESTBED_EVENTS_H diff --git a/engines/testbed/fs.cpp b/engines/testbed/fs.cpp index 6951793e5c..5e406d902f 100644 --- a/engines/testbed/fs.cpp +++ b/engines/testbed/fs.cpp @@ -29,6 +29,7 @@ #include "testbed/fs.h" namespace Testbed { + /** * This test does the following: * 1) acquires the game-data path @@ -49,8 +50,8 @@ bool FStests::readDataFromFile(Common::FSDirectory *directory, const char *file) Common::String msg = readStream->readLine(); delete readStream; - Testsuite::logDetailedPrintf("Message Extracted from %s/%s : %s\n",directory->getFSNode().getName().c_str(), file, msg.c_str()); + Testsuite::logDetailedPrintf("Message Extracted from %s/%s : %s\n", directory->getFSNode().getName().c_str(), file, msg.c_str()); Common::String expectedMsg = "It works!"; @@ -62,7 +63,6 @@ bool FStests::readDataFromFile(Common::FSDirectory *directory, const char *file) return true; } - bool FStests::testReadFile() { const Common::String &path = ConfMan.get("path"); Common::FSDirectory gameRoot(path); @@ -113,7 +113,6 @@ bool FStests::testReadFile() { * 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() { const Common::String &path = ConfMan.get("path"); Common::FSNode gameRoot(path); @@ -141,7 +140,6 @@ bool FStests::testWriteFile() { return true; } - return false; } diff --git a/engines/testbed/fs.h b/engines/testbed/fs.h index 07060ec457..1ffda0927b 100644 --- a/engines/testbed/fs.h +++ b/engines/testbed/fs.h @@ -45,7 +45,8 @@ bool testReadFile(); bool testWriteFile(); bool testOpeningSaveFile(); // add more here -} + +} // End of namespace FStests class FSTestSuite : public Testsuite { public: @@ -58,11 +59,11 @@ public: * @see addTest() */ FSTestSuite(); - ~FSTestSuite(){} + ~FSTestSuite() {} const char *getName() const; void enable(bool flag); }; -} // End of namespace Testbed +} // End of namespace Testbed -#endif +#endif // TESTBED_FS_H diff --git a/engines/testbed/graphics.cpp b/engines/testbed/graphics.cpp index eb3f6e376d..b8a3e1ff63 100644 --- a/engines/testbed/graphics.cpp +++ b/engines/testbed/graphics.cpp @@ -74,7 +74,6 @@ GFXTestSuite::GFXTestSuite() { // Specific Tests: addTest("Palette Rotation", &GFXtests::paletteRotation); //addTest("Pixel Formats", &GFXtests::pixelFormats); - } const char *GFXTestSuite::getName() const { @@ -99,7 +98,6 @@ void GFXtests::initMousePalette() { palette[10] = 0; CursorMan.replaceCursorPalette(palette, 0, 3); - } Common::Rect GFXtests::computeSize(Common::Rect &cursorRect, int scalingFactor, int cursorTargetScale) { @@ -124,8 +122,7 @@ Common::Rect GFXtests::computeSize(Common::Rect &cursorRect, int scalingFactor, } } -void GFXtests::HSVtoRGB(int& rComp, int& gComp, int& bComp, int hue, int sat, int val) { - +void GFXtests::HSVtoRGB(int &rComp, int &gComp, int &bComp, int hue, int sat, int val) { float r = rComp; float g = gComp; float b = bComp; @@ -143,43 +140,43 @@ void GFXtests::HSVtoRGB(int& rComp, int& gComp, int& bComp, int hue, int sat, in } h /= 60; - i = (int) h; + i = (int)h; f = h - i; p = v * (1 - s); q = v * (1 - s * f); t = v * (1 - s * (1 - f)); switch (i) { - case 0: - r = v; - g = t; - b = p; - break; - case 1: - r = q; - g = v; - b = p; - break; - case 2: - r = p; - g = v; - b = t; - break; - case 3: - r = p; - g = q; - b = v; - break; - case 4: - r = t; - g = p; - b = v; - break; - default: - r = v; - g = p; - b = q; - break; + case 0: + r = v; + g = t; + b = p; + break; + case 1: + r = q; + g = v; + b = p; + break; + case 2: + r = p; + g = v; + b = t; + break; + case 3: + r = p; + g = q; + b = v; + break; + case 4: + r = t; + g = p; + b = v; + break; + default: + r = v; + g = p; + b = q; + break; } rComp = r * 255; @@ -188,7 +185,6 @@ void GFXtests::HSVtoRGB(int& rComp, int& gComp, int& bComp, int hue, int sat, in } Common::Rect GFXtests::drawCursor(bool cursorPaletteDisabled, const char *gfxModeName, int cursorTargetScale) { - // Buffer initialized with yellow color byte buffer[500]; memset(buffer, 2, sizeof(buffer)); @@ -238,14 +234,13 @@ void rotatePalette(byte *palette, int size) { memcpy(&palette[i * 4], &palette[(i + 1) * 4], 4 * sizeof(byte)); } // Assign last color to tcolor - memcpy(&palette[(size -1) * 4], tColor, 4 * sizeof(byte)); + memcpy(&palette[(size - 1) * 4], tColor, 4 * sizeof(byte)); } /** * Sets up mouse loop, exits when user clicks any of the mouse button */ void GFXtests::setupMouseLoop(bool disableCursorPalette, const char *gfxModeName, int cursorTargetScale) { - bool isFeaturePresent; isFeaturePresent = g_system->hasFeature(OSystem::kFeatureCursorHasPalette); Common::Rect cursorRect; @@ -285,7 +280,7 @@ void GFXtests::setupMouseLoop(bool disableCursorPalette, const char *gfxModeName estimatedCursorRect = computeSize(cursorRect, 1, cursorTargetScale); } else if (gfxScalarMode.contains("2x")) { estimatedCursorRect = computeSize(cursorRect, 2, cursorTargetScale); - } else if (gfxScalarMode.contains("3x")){ + } else if (gfxScalarMode.contains("3x")) { estimatedCursorRect = computeSize(cursorRect, 3, cursorTargetScale); } else { // If unable to detect scaler, default to 2 @@ -360,11 +355,8 @@ void GFXtests::mouseMovements() { /** * Used by aspectRatio() */ - void GFXtests::drawEllipse(int cx, int cy, int a, int b) { - // Take a buffer of screen size - byte buffer[200][320] = {{0}}; float theta; int x, y, x1, y1; @@ -374,7 +366,7 @@ void GFXtests::drawEllipse(int cx, int cy, int a, int b) { // Illuminate the points lying on ellipse - for (theta = 0; theta <= PI / 2; theta += PI / 360 ) { + for (theta = 0; theta <= PI / 2; theta += PI / 360) { x = (int)(b * sin(theta) + 0.5); y = (int)(a * cos(theta) + 0.5); @@ -410,9 +402,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() { - Common::Point pt(0, 100); Common::Rect rect = Testsuite::writeOnScreen("Testing fullscreen mode", pt); @@ -488,10 +478,8 @@ bool GFXtests::fullScreenMode() { /** * Tests the aspect ratio correction by: drawing an ellipse, when corrected the ellipse should render to a circle */ - bool GFXtests::aspectRatio() { // Draw an ellipse on the screen - drawEllipse(100, 160, 72, 60); Common::Point pt(0, 180); @@ -554,14 +542,11 @@ 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() { - - bool passed = true; Testsuite::displayMessage("Testing Cursors. You should expect to see a yellow colored square cursor.\n" - "You should be able to move it. The test finishes when the mouse(L/R) is clicked"); + "You should be able to move it. The test finishes when the mouse(L/R) is clicked"); // Testing with cursor Palette setupMouseLoop(); @@ -599,7 +584,7 @@ bool GFXtests::palettizedCursors() { */ bool GFXtests::copyRectToScreen() { Testsuite::displayMessage("Testing Blitting a Bitmap to screen.\n" - "You should expect to see a 20x40 yellow horizontal rectangle centred at the screen."); + "You should expect to see a 20x40 yellow horizontal rectangle centred at the screen."); GFXTestSuite::setCustomColor(255, 255, 0); byte buffer[20 * 40]; @@ -612,7 +597,7 @@ bool GFXtests::copyRectToScreen() { g_system->updateScreen(); g_system->delayMillis(1000); - Common::Rect rect(x, y, x+40, y+20); + Common::Rect rect(x, y, x + 40, y + 20); Testsuite::clearScreen(); if (Testsuite::handleInteractiveInput("Did the test worked as you were expecting?", "Yes", "No", kOptionRight)) { @@ -620,7 +605,6 @@ bool GFXtests::copyRectToScreen() { } return true; - } /** @@ -628,9 +612,8 @@ bool GFXtests::copyRectToScreen() { * It is expected the screen minimizes when this feature is enabled */ bool GFXtests::iconifyWindow() { - Testsuite::displayMessage("Testing Iconify Window mode.\n If the feature is supported by the backend," - "you should expect the window to be minimized. However you would manually need to de-iconify."); + "you should expect the window to be minimized. However you would manually need to de-iconify."); Common::Point pt(0, 100); Common::Rect rect = Testsuite::writeOnScreen("Testing Iconifying window", pt); @@ -669,13 +652,12 @@ bool GFXtests::iconifyWindow() { /** * Testing feature: Scaled cursors */ - bool GFXtests::scaledCursors() { Testsuite::displayMessage("Testing : Scaled cursors\n" - "Here every graphics mode is tried with a cursorTargetScale of 1,2 and 3.\n" - "The expected cursor size is drawn as a rectangle, the cursor should entirely cover 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"); + "Here every graphics mode is tried with a cursorTargetScale of 1,2 and 3.\n" + "The expected cursor size is drawn as a rectangle, the cursor should entirely cover 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"); int maxLimit = 1000; if (!Testsuite::handleInteractiveInput("Do you want to restrict scalers to 1x, 2x and 3x only?", "Yes", "No", kOptionRight)) { @@ -697,7 +679,6 @@ bool GFXtests::scaledCursors() { OSystem::TransactionError gfxError = g_system->endGFXTransaction(); if (gfxError == OSystem::kTransactionSuccess && isGFXModeSet) { - setupMouseLoop(false, gfxMode->name, 1); Testsuite::clearScreen(); @@ -706,7 +687,6 @@ bool GFXtests::scaledCursors() { setupMouseLoop(false, gfxMode->name, 3); Testsuite::clearScreen(); - } else { Testsuite::logDetailedPrintf("Switching to graphics mode %s failed\n", gfxMode->name); return false; @@ -753,9 +733,8 @@ bool GFXtests::shakingEffect() { } bool GFXtests::focusRectangle() { - Testsuite::displayMessage("Testing : Setting and hiding Focus \n" - "If this feature is implemented, the focus should be toggled between the two rectangles on the corners"); + "If this feature is implemented, the focus should be toggled between the two rectangles on the corners"); const Graphics::Font &font(*FontMan.getFontByUsage(Graphics::FontManager::kConsoleFont)); @@ -797,7 +776,6 @@ bool GFXtests::focusRectangle() { } bool GFXtests::overlayGraphics() { - Graphics::PixelFormat pf = g_system->getOverlayFormat(); OverlayColor buffer[50 * 100]; @@ -867,7 +845,6 @@ bool GFXtests::paletteRotation() { g_system->updateScreen(); g_system->delayMillis(1000); - bool toRotate = true; Common::Event event; CursorMan.showMouse(true); @@ -880,13 +857,13 @@ bool GFXtests::paletteRotation() { } /*for (int i = 2; i < 256; i++) { - debug("Palette: (%d %d %d) #", palette[i*4], palette[i*4+1], palette[i*4+2]); + debug("Palette: (%d %d %d) #", palette[i * 4], palette[i * 4 + 1], palette[i * 4 + 2]); }*/ rotatePalette(&palette[8], 254); /*for (int i = 2; i < 256; i++) { - debug("Palette: (%d %d %d) #", palette[i*4], palette[i*4+1], palette[i*4+2]); + debug("Palette: (%d %d %d) #", palette[i * 4], palette[i * 4 + 1], palette[i * 4 + 2]); }*/ g_system->delayMillis(10); @@ -918,7 +895,6 @@ bool GFXtests::pixelFormats() { Testsuite::logDetailedPrintf("Testing Pixel Formats. Size of list : %d\n", pfList.size()); for (iter = pfList.begin(); iter != pfList.end(); iter++) { - numFormatsTested++; if (iter->bytesPerPixel == 1) { // Palettes already tested @@ -934,7 +910,6 @@ bool GFXtests::pixelFormats() { g_system->endGFXTransaction(); Testsuite::clearScreen(true); - // Draw some nice gradients // Pick up some colors uint colors[6]; @@ -984,7 +959,6 @@ bool GFXtests::pixelFormats() { initMousePalette(); Testsuite::clearScreen(); - if (numFailed) { Testsuite::logDetailedPrintf("Pixel Format test: Failed : %d, Passed : %d, Ignored %d\n",numFailed, numPassed, numFormatsTested - (numPassed + numFailed)); return false; @@ -993,4 +967,4 @@ bool GFXtests::pixelFormats() { return true; } -} +} // End of namespace Testbed diff --git a/engines/testbed/graphics.h b/engines/testbed/graphics.h index 8ee0328642..ad3eff301b 100644 --- a/engines/testbed/graphics.h +++ b/engines/testbed/graphics.h @@ -37,7 +37,7 @@ void setupMouseLoop(bool disableCursorPalette = false, const char *gfxModeName = void initMousePalette(); void mouseMovements(); Common::Rect computeSize(Common::Rect &cursorRect, int scalingFactor, int cursorTargetScale); -void HSVtoRGB(int& rComp, int& gComp,int& bComp, int hue, int sat, int val); +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 @@ -53,7 +53,8 @@ bool overlayGraphics(); bool paletteRotation(); bool pixelFormats(); // add more here -} + +} // End of namespace GFXtests class GFXTestSuite : public Testsuite { public: @@ -66,7 +67,7 @@ public: * @see addTest() */ GFXTestSuite(); - ~GFXTestSuite(){} + ~GFXTestSuite() {} const char *getName() const; static void setCustomColor(uint r, uint g, uint b); @@ -82,6 +83,6 @@ private: static byte _palette[256 * 4]; }; -} // End of namespace Testbed +} // End of namespace Testbed -#endif +#endif // TESTBED_GRAPHICS_H diff --git a/engines/testbed/misc.cpp b/engines/testbed/misc.cpp index 46a2788690..ffd3e2c537 100644 --- a/engines/testbed/misc.cpp +++ b/engines/testbed/misc.cpp @@ -43,7 +43,7 @@ void MiscTests::timerCallback(void *arg) { } void MiscTests::criticalSection(void *arg) { - SharedVars &sv = *((SharedVars *) arg); + SharedVars &sv = *((SharedVars *)arg); Testsuite::logDetailedPrintf("Before critical section: %d %d\n", sv.first, sv.second); g_system->lockMutex(sv.mutex); @@ -56,6 +56,7 @@ void MiscTests::criticalSection(void *arg) { sv.first++; g_system->delayMillis(1000); + // This should bring no change as well in the difference between vars // verify this too. if (sv.second + 1 != sv.first) { @@ -94,7 +95,7 @@ bool MiscTests::testDateTime() { Testsuite::logDetailedPrintf("%s\n", dateTimeNow.c_str()); if (t1.tm_year == t2.tm_year && t1.tm_mon == t2.tm_mon && t1.tm_mday == t2.tm_mday) { - if (t1.tm_mon == t2.tm_mon && t1.tm_year == t2.tm_year){ + 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; @@ -129,6 +130,7 @@ bool MiscTests::testMutexes() { g_system->delayMillis(1000); sv.second *= sv.first; g_system->unlockMutex(sv.mutex); + // wait till timed process exits g_system->delayMillis(3000); @@ -147,6 +149,7 @@ MiscTestSuite::MiscTestSuite() { addTest("Timers", &MiscTests::testTimers, false); addTest("Mutexes", &MiscTests::testMutexes, false); } + const char *MiscTestSuite::getName() const { return "Misc"; } diff --git a/engines/testbed/misc.h b/engines/testbed/misc.h index d1ebdc2152..0c563e83c2 100644 --- a/engines/testbed/misc.h +++ b/engines/testbed/misc.h @@ -52,7 +52,8 @@ bool testDateTime(); bool testTimers(); bool testMutexes(); // add more here -} + +} // End of namespace MiscTests class MiscTestSuite : public Testsuite { public: @@ -65,11 +66,10 @@ public: * @see addTest() */ MiscTestSuite(); - ~MiscTestSuite(){} + ~MiscTestSuite() {} const char *getName() const; - }; -} // End of namespace Testbed +} // End of namespace Testbed -#endif +#endif // TESTBED_MISC_H diff --git a/engines/testbed/savegame.cpp b/engines/testbed/savegame.cpp index 9f9097219c..6bd233e34f 100644 --- a/engines/testbed/savegame.cpp +++ b/engines/testbed/savegame.cpp @@ -32,9 +32,7 @@ namespace Testbed { * This test creates a savefile for the given testbed-state and could be reloaded using the saveFile API. * It is intended to test saving and loading from savefiles. */ - bool SaveGametests::writeDataToFile(const char *fileName, const char *msg) { - Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); Common::OutSaveFile *saveFile = saveFileMan->openForSaving(fileName); @@ -51,7 +49,6 @@ bool SaveGametests::writeDataToFile(const char *fileName, const char *msg) { } bool SaveGametests::readAndVerifyData(const char *fileName, const char *expected) { - Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); Common::InSaveFile *loadFile = saveFileMan->openForLoading(fileName); @@ -70,7 +67,6 @@ bool SaveGametests::readAndVerifyData(const char *fileName, const char *expected return false; } - bool SaveGametests::testSaveLoadState() { // create a savefile with "ScummVM Rocks!" written on it if (!writeDataToFile("tBedSavefile.0", "ScummVM Rocks!")) { @@ -88,7 +84,6 @@ bool SaveGametests::testSaveLoadState() { } bool SaveGametests::testRemovingSavefile() { - Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); // Create a dummy savefile @@ -143,7 +138,7 @@ bool SaveGametests::testListingSavefile() { Common::Error error = saveFileMan->getError(); - if ( error != Common::kNoError) { + if (error != Common::kNoError) { // Abort. Some Error in writing files Testsuite::logDetailedPrintf("Error while creating savefiles: %s\n", Common::errorToString(error)); return false; @@ -174,7 +169,6 @@ bool SaveGametests::testListingSavefile() { return false; } - bool SaveGametests::testErrorMessages() { Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); saveFileMan->clearError(); @@ -206,4 +200,4 @@ const char *SaveGameTestSuite::getName() const { return "SaveGames"; } -} // End of namespace testbed +} // End of namespace Testbed diff --git a/engines/testbed/savegame.h b/engines/testbed/savegame.h index ee2c63006b..5ce27df6d2 100644 --- a/engines/testbed/savegame.h +++ b/engines/testbed/savegame.h @@ -41,7 +41,8 @@ bool testRenamingSavefile(); bool testListingSavefile(); bool testErrorMessages(); // add more here -} + +} // End of namespace SaveGametests class SaveGameTestSuite : public Testsuite { public: @@ -54,11 +55,10 @@ public: * @see addTest() */ SaveGameTestSuite(); - ~SaveGameTestSuite(){} + ~SaveGameTestSuite() {} const char *getName() const; - }; -} // End of namespace Testbed +} // End of namespace Testbed -#endif +#endif // TESTBED_SAVEGAME_H diff --git a/engines/testbed/template.h b/engines/testbed/template.h index dcf331a49f..6ce5c78344 100644 --- a/engines/testbed/template.h +++ b/engines/testbed/template.h @@ -37,7 +37,8 @@ namespace XXXtests { // will contain function declarations for XXX tests // add more here -} + +} // End of namespace XXXtests class XXXTestSuite : public Testsuite { public: @@ -50,11 +51,11 @@ public: * @see addTest() */ XXXTestSuite(); - ~XXXTestSuite(){} + ~XXXTestSuite() {} const char *getName() const; }; -} // End of namespace Testbed +} // End of namespace Testbed -#endif +#endif // TESTBED_TEMPLATE_H diff --git a/engines/testbed/testbed.cpp b/engines/testbed/testbed.cpp index 762d67b156..3898040a21 100644 --- a/engines/testbed/testbed.cpp +++ b/engines/testbed/testbed.cpp @@ -79,13 +79,13 @@ TestbedEngine::~TestbedEngine() { // Remove all of our debug levels here DebugMan.clearAllDebugChannels(); - for (Common::Array::const_iterator i = _testsuiteList.begin(); i != _testsuiteList.end(); ++i) { + for (Common::Array::const_iterator i = _testsuiteList.begin(); i != _testsuiteList.end(); ++i) { delete (*i); } } void TestbedEngine::enableTestsuite(const Common::String &name, bool enable) { - Common::Array::const_iterator iter; + Common::Array::const_iterator iter; for (iter = _testsuiteList.begin(); iter != _testsuiteList.end(); iter++) { if (name.equalsIgnoreCase((*iter)->getName())) { @@ -98,13 +98,13 @@ void TestbedEngine::enableTestsuite(const Common::String &name, bool enable) { } void TestbedEngine::invokeTestsuites() { - Common::Array::const_iterator iter; + Common::Array::const_iterator iter; for (iter = _testsuiteList.begin(); iter != _testsuiteList.end(); iter++) { if ((*iter)->isEnabled()) { (*iter)->execute(); - } } + } } TestbedOptionsDialog::TestbedOptionsDialog() : GUI::OptionsDialog("Select", 120, 120, 360, 200), _hOffset(15), _vOffset(15), _boxWidth(300), _boxHeight(10) { diff --git a/engines/testbed/testbed.h b/engines/testbed/testbed.h index 0a6a235e17..fdc8d2e0b0 100644 --- a/engines/testbed/testbed.h +++ b/engines/testbed/testbed.h @@ -79,4 +79,4 @@ private: } // End of namespace Testbed -#endif +#endif // TESTBED_H diff --git a/engines/testbed/testsuite.cpp b/engines/testbed/testsuite.cpp index 52502aefec..280959b1c9 100644 --- a/engines/testbed/testsuite.cpp +++ b/engines/testbed/testsuite.cpp @@ -113,14 +113,14 @@ void Testsuite::logDetailedPrintf(const char *fmt, ...) { } Testsuite::Testsuite() { - _numTestsPassed = 0; - _numTestsExecuted = 0; - // Initially all testsuites are disabled, enable them by calling enableTestSuite(name, true) - _isTsEnabled = false; + _numTestsPassed = 0; + _numTestsExecuted = 0; + // Initially all testsuites are disabled, enable them by calling enableTestSuite(name, true) + _isTsEnabled = false; } Testsuite::~Testsuite() { - for (Common::Array::iterator i = _testsToExecute.begin(); i != _testsToExecute.end(); ++i) { + for (Common::Array::iterator i = _testsToExecute.begin(); i != _testsToExecute.end(); ++i) { delete (*i); } } @@ -128,7 +128,7 @@ Testsuite::~Testsuite() { void Testsuite::genReport() const { logPrintf("\n"); logPrintf("Consolidating results...\n"); - logPrintf("Subsystem: %s ",getName()); + logPrintf("Subsystem: %s ", getName()); logPrintf("(Tests Executed: %d)\n", _numTestsExecuted); logPrintf("Passed: %d ", _numTestsPassed); logPrintf("Failed: %d\n", getNumTestsFailed()); @@ -136,12 +136,12 @@ void Testsuite::genReport() const { } bool Testsuite::handleInteractiveInput(const Common::String &textToDisplay, const char *opt1, const char *opt2, OptionSelected result) { - GUI::MessageDialog prompt(textToDisplay, opt1, opt2); + GUI::MessageDialog prompt(textToDisplay, opt1, opt2); return prompt.runModal() == result ? true : false; } void Testsuite::displayMessage(const Common::String &textToDisplay, const char *defaultButton, const char *altButton) { - GUI::MessageDialog prompt(textToDisplay, defaultButton); + GUI::MessageDialog prompt(textToDisplay, defaultButton); prompt.runModal(); } @@ -159,8 +159,8 @@ Common::Rect Testsuite::writeOnScreen(const Common::String &textToDisplay, const if (flag) { Graphics::PixelFormat pf = g_system->getScreenFormat(); - fillColor = pf.RGBToColor(0 , 0, 0); - textColor = pf.RGBToColor(255 , 255, 255); + fillColor = pf.RGBToColor(0, 0, 0); + textColor = pf.RGBToColor(255, 255, 255); } screen->fillRect(rect, fillColor); @@ -206,7 +206,7 @@ void Testsuite::clearScreen(bool flag) { } void Testsuite::addTest(const Common::String &name, InvokingFunction f, bool isInteractive) { - Test* featureTest = new Test(name, f, isInteractive); + Test *featureTest = new Test(name, f, isInteractive); _testsToExecute.push_back(featureTest); } @@ -245,7 +245,7 @@ void Testsuite::execute() { return; } - for (Common::Array::iterator i = _testsToExecute.begin(); i != _testsToExecute.end(); ++i) { + for (Common::Array::iterator i = _testsToExecute.begin(); i != _testsToExecute.end(); ++i) { if (toQuit == kSkipNext) { logPrintf("Info! Skipping Test: %s, Skipped by user.\n", ((*i)->featureName).c_str()); toQuit = kLoopNormal; @@ -280,5 +280,4 @@ void Testsuite::execute() { genReport(); } -} // end of namespace Testebed - +} // End of namespace Testebed diff --git a/engines/testbed/testsuite.h b/engines/testbed/testsuite.h index 5438176a34..cc9278cc4c 100644 --- a/engines/testbed/testsuite.h +++ b/engines/testbed/testsuite.h @@ -136,7 +136,7 @@ public: static void deleteWriteStream(); protected: - Common::Array _testsToExecute; ///< List of tests to be executed + Common::Array _testsToExecute; ///< List of tests to be executed int _numTestsPassed; ///< Number of tests passed int _numTestsExecuted; ///< Number of tests executed bool _isTsEnabled; @@ -163,6 +163,6 @@ private: static Common::WriteStream *_ws; }; -} // End of namespace testbed +} // End of namespace Testbed -#endif +#endif // TESTBED_TESTSUITE_H -- cgit v1.2.3