diff options
author | Neeraj Kumar | 2010-06-08 17:24:29 +0000 |
---|---|---|
committer | Neeraj Kumar | 2010-06-08 17:24:29 +0000 |
commit | 207a5e0779de9f0002b0b1984bde90ce6597e1f2 (patch) | |
tree | 98883ef89261afd4288f6dadbffe436d5d966dfc /engines/testbed | |
parent | e00e94ae18aeb1ed460476f822e20b5bdfe171a4 (diff) | |
parent | 356728dab7f2c4cedf73684d7fe3b968be7396fd (diff) | |
download | scummvm-rg350-207a5e0779de9f0002b0b1984bde90ce6597e1f2.tar.gz scummvm-rg350-207a5e0779de9f0002b0b1984bde90ce6597e1f2.tar.bz2 scummvm-rg350-207a5e0779de9f0002b0b1984bde90ce6597e1f2.zip |
updated my outdate copy of trunk, added couple of more tests in gfxtests
svn-id: r49510
Diffstat (limited to 'engines/testbed')
-rw-r--r-- | engines/testbed/gfxtests.cpp | 93 | ||||
-rw-r--r-- | engines/testbed/gfxtests.h | 2 | ||||
-rw-r--r-- | engines/testbed/graphics.cpp | 11 | ||||
-rw-r--r-- | engines/testbed/graphics.h | 4 |
4 files changed, 102 insertions, 8 deletions
diff --git a/engines/testbed/gfxtests.cpp b/engines/testbed/gfxtests.cpp index 092e56ab39..2eeb7125b2 100644 --- a/engines/testbed/gfxtests.cpp +++ b/engines/testbed/gfxtests.cpp @@ -1,8 +1,10 @@ #include "testbed/gfxtests.h" +#include "testbed/graphics.h" #include "testbed/testsuite.h" #include "graphics/fontman.h" #include "graphics/surface.h" +#include "graphics/cursorman.h" namespace Testbed { @@ -13,13 +15,13 @@ bool testFullScreenMode() { Common::Point pt(0,100); Common::Rect rect = Testsuite::writeOnScreen("Testing fullscreen mode", pt); - g_system->delayMillis(1000); bool isFeaturePresent; bool isFeatureEnabled; isFeaturePresent = g_system->hasFeature(OSystem::kFeatureFullscreenMode); isFeatureEnabled = g_system->getFeatureState(OSystem::kFeatureFullscreenMode); + g_system->delayMillis(1000); if (isFeaturePresent) { //Toggle @@ -43,7 +45,96 @@ bool testFullScreenMode() { } bool testAspectRatio() { + Testsuite::displayMessage("Testing Aspect Ratio Correction. \n \ + With this feature enabled games running at 320x200 should be scaled upto 320x240 pixels"); + + Common::Point pt(0,100); + Common::Rect rect = Testsuite::writeOnScreen("Testing Aspect ratio correction", pt); + + bool isFeaturePresent; + bool isFeatureEnabled; + + isFeaturePresent = g_system->hasFeature(OSystem::kFeatureAspectRatioCorrection); + isFeatureEnabled = g_system->getFeatureState(OSystem::kFeatureAspectRatioCorrection); + g_system->delayMillis(1000); + + if (isFeaturePresent) { + //Toggle + + g_system->beginGFXTransaction(); + g_system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, !isFeatureEnabled); + g_system->endGFXTransaction(); + + g_system->delayMillis(1000); + + g_system->beginGFXTransaction(); + g_system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, isFeatureEnabled); + g_system->endGFXTransaction(); + } + else { + Testsuite::displayMessage("feature not supported"); + } + + Testsuite::clearScreen(rect); return true; } +bool testPalettizedCursors() { + Testsuite::displayMessage("Testing Cursors. You should expect to see a red colored cursor.\n"); + + Common::Point pt(0,100); + Common::Rect rect = Testsuite::writeOnScreen("Testing Palettized Cursors", pt); + + bool isFeaturePresent; + bool isFeatureEnabled; + + isFeaturePresent = g_system->hasFeature(OSystem::kFeatureCursorHasPalette); + isFeatureEnabled = g_system->getFeatureState(OSystem::kFeatureCursorHasPalette); + g_system->delayMillis(1000); + + if (isFeaturePresent) { + byte palette[3 * 4]; // Black, white and yellow + palette[0] = palette[1] = palette[2] = 0; + palette[4] = palette[5] = palette[6] = 255; + palette[8] = palette[9] = 255; + palette[10] = 0; + + byte buffer[10 * 10]; + memset(buffer, 2, 10 * 10); + + CursorMan.pushCursorPalette(palette, 0, 3); + CursorMan.pushCursor(buffer, 10, 10, 40, 40, 2, 1); + CursorMan.showMouse(true); + g_system->updateScreen(); + } + else { + Testsuite::displayMessage("feature not supported"); + } + Testsuite::clearScreen(rect); + return true; +} + +bool testCopyRectToScreen() { + Testsuite::displayMessage("Testing Blitting a Bitmap to screen. \n\ + You should expect to see a 20x40 yellow horizontal rectangle centred at the screen."); + + GFXTestSuite::setCustomColor(255, 255, 0); + byte buffer[20 * 40]; + memset(buffer, 2, 20 * 40); + + uint x = g_system->getWidth() / 2 - 20; + uint y = g_system->getHeight() / 2 - 10; + + g_system->copyRectToScreen(buffer, 40, x, y, 40, 20); + g_system->updateScreen(); + g_system->delayMillis(1000); + + Common::Rect rect(x, y, x+40, y+20); + Testsuite::clearScreen(rect); + + return true; + +} + + } diff --git a/engines/testbed/gfxtests.h b/engines/testbed/gfxtests.h index 7f5ae7d8af..bd219411e9 100644 --- a/engines/testbed/gfxtests.h +++ b/engines/testbed/gfxtests.h @@ -6,6 +6,8 @@ namespace Testbed { // will contain function declarations for GFX tests bool testFullScreenMode(); bool testAspectRatio(); +bool testPalettizedCursors(); +bool testCopyRectToScreen(); // add more here } diff --git a/engines/testbed/graphics.cpp b/engines/testbed/graphics.cpp index a5658a1213..ea1c1b1130 100644 --- a/engines/testbed/graphics.cpp +++ b/engines/testbed/graphics.cpp @@ -3,19 +3,20 @@ namespace Testbed { +byte GFXTestSuite::_palette[3 * 4] = {0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0}; + GFXTestSuite::GFXTestSuite() { // Initialize color palettes // Te fourth field is for alpha channel which is unused // Assuming 8bpp as of now - _palette[0] =_palette[1] =_palette[2] = 0; - _palette[4] =_palette[5] =_palette[6] = 255; - _palette[8] =_palette[9] =_palette[10] = 255; g_system->setPalette(_palette, 0, 3); g_system->grabPalette(_palette, 0, 3); // Add tests here - addTest("FullScreenMode", &testFullScreenMode); - addTest("AspectRatio", &testAspectRatio); +// addTest("FullScreenMode", &testFullScreenMode); +// addTest("AspectRatio", &testAspectRatio); + addTest("PalettizedCursors", &testPalettizedCursors); +// addTest("BlitBitmaps", &testCopyRectToScreen); } const char *GFXTestSuite::getName() { diff --git a/engines/testbed/graphics.h b/engines/testbed/graphics.h index 5dcd02abac..eb84310db7 100644 --- a/engines/testbed/graphics.h +++ b/engines/testbed/graphics.h @@ -19,7 +19,7 @@ public: ~GFXTestSuite(){} void execute(); const char *getName(); - void setCustomColor(uint r, uint g, uint b); + static void setCustomColor(uint r, uint g, uint b); private: /** @@ -29,7 +29,7 @@ private: * 1 (R:255, G:255, B:255) White (kColorWhite) * 2 (R:255, G:255, B:255) your customized color (by default white) (kColorCustom) */ - byte _palette[3 * 4]; + static byte _palette[3 * 4]; }; } // End of namespace Testbed |