aboutsummaryrefslogtreecommitdiff
path: root/engines/testbed/graphics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/testbed/graphics.cpp')
-rw-r--r--engines/testbed/graphics.cpp130
1 files changed, 129 insertions, 1 deletions
diff --git a/engines/testbed/graphics.cpp b/engines/testbed/graphics.cpp
index 43580104e7..1b5af76ee7 100644
--- a/engines/testbed/graphics.cpp
+++ b/engines/testbed/graphics.cpp
@@ -47,6 +47,7 @@ GFXTestSuite::GFXTestSuite() {
// Init Mouse Palette (White-black-yellow)
GFXtests::initMousePalette();
+ GFXtests::initMouseCursor();
// Add tests here
@@ -55,6 +56,7 @@ GFXTestSuite::GFXTestSuite() {
// GFX Transcations
addTest("FullScreenMode", &GFXtests::fullScreenMode);
+ addTest("FilteringMode", &GFXtests::filteringMode);
addTest("AspectRatio", &GFXtests::aspectRatio);
addTest("IconifyingWindow", &GFXtests::iconifyWindow);
@@ -103,6 +105,29 @@ void GFXtests::initMousePalette() {
CursorMan.replaceCursorPalette(palette, 0, 3);
}
+static const byte MOUSECURSOR_SCI[] = {
+ 1,1,0,0,0,0,0,0,0,0,0,
+ 1,2,1,0,0,0,0,0,0,0,0,
+ 1,2,2,1,0,0,0,0,0,0,0,
+ 1,2,2,2,1,0,0,0,0,0,0,
+ 1,2,2,2,2,1,0,0,0,0,0,
+ 1,2,2,2,2,2,1,0,0,0,0,
+ 1,2,2,2,2,2,2,1,0,0,0,
+ 1,2,2,2,2,2,2,2,1,0,0,
+ 1,2,2,2,2,2,2,2,2,1,0,
+ 1,2,2,2,2,2,2,2,2,2,1,
+ 1,2,2,2,2,2,1,0,0,0,0,
+ 1,2,1,0,1,2,2,1,0,0,0,
+ 1,1,0,0,1,2,2,1,0,0,0,
+ 0,0,0,0,0,1,2,2,1,0,0,
+ 0,0,0,0,0,1,2,2,1,0,0,
+ 0,0,0,0,0,0,1,2,2,1,0
+};
+
+void GFXtests::initMouseCursor() {
+ CursorMan.replaceCursor(MOUSECURSOR_SCI, 11, 16, 0, 0, 0);
+}
+
Common::Rect GFXtests::computeSize(const Common::Rect &cursorRect, int scalingFactor, int cursorTargetScale) {
if (cursorTargetScale == 1 || scalingFactor == 1) {
// Game data and cursor would be scaled equally.
@@ -464,7 +489,7 @@ TestExitStatus GFXtests::fullScreenMode() {
prompt = "This should be your initial state. Is it?";
- if (!Testsuite::handleInteractiveInput(prompt, "Yes, it is", "Nopes", shouldSelect)) {
+ if (!Testsuite::handleInteractiveInput(prompt, "Yes, it is", "Nopes", kOptionLeft)) {
// User selected incorrect mode
Testsuite::logDetailedPrintf("switching back to initial state failed\n");
passed = kTestFailed;
@@ -478,6 +503,106 @@ TestExitStatus GFXtests::fullScreenMode() {
}
/**
+ * Tests the filtering mode by: toggling between filtered and non-filtered modes.
+ */
+TestExitStatus GFXtests::filteringMode() {
+ Testsuite::clearScreen();
+ Common::String info = "Filtering test. Here you should expect a toggle between filtered and non-filtered states depending "
+ "upon your initial state.";
+
+ Common::Point pt(0, 100);
+ Testsuite::writeOnScreen("Testing filtering mode", pt);
+
+ if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
+ Testsuite::logPrintf("Info! Skipping test : FilteringMode\n");
+ return kTestSkipped;
+ }
+
+ bool isFeaturePresent;
+ bool isFeatureEnabled;
+ TestExitStatus passed = kTestPassed;
+ Common::String prompt;
+ OptionSelected shouldSelect;
+
+ isFeaturePresent = g_system->hasFeature(OSystem::kFeatureFilteringMode);
+
+ if (isFeaturePresent) {
+ // Toggle
+ isFeatureEnabled = g_system->getFeatureState(OSystem::kFeatureFilteringMode);
+ shouldSelect = isFeatureEnabled ? kOptionLeft : kOptionRight;
+
+ // Do test in fullscreen if possible as filtering may have no effect in windowed mode
+ bool fullScreenToggled = false;
+ if (g_system->hasFeature(OSystem::kFeatureFullscreenMode) && !g_system->getFeatureState(OSystem::kFeatureFullscreenMode)) {
+ fullScreenToggled = true;
+ g_system->beginGFXTransaction();
+ g_system->setFeatureState(OSystem::kFeatureFullscreenMode, true);
+ g_system->endGFXTransaction();
+ }
+
+ g_system->delayMillis(1000);
+
+ if (isFeatureEnabled) {
+ Testsuite::logDetailedPrintf("Current Mode is Filtered\n");
+ } else {
+ Testsuite::logDetailedPrintf("Current Mode is Unfiltered\n");
+ }
+
+ prompt = " Which mode do you see currently ? ";
+
+ if (!Testsuite::handleInteractiveInput(prompt, "Filtered", "Unfiltered", shouldSelect)) {
+ // User selected incorrect current state
+ passed = kTestFailed;
+ Testsuite::logDetailedPrintf("g_system->getFeatureState() failed\n");
+ }
+
+ g_system->beginGFXTransaction();
+ g_system->setFeatureState(OSystem::kFeatureFilteringMode, !isFeatureEnabled);
+ g_system->endGFXTransaction();
+
+ // Current state should be now !isFeatureEnabled
+ isFeatureEnabled = g_system->getFeatureState(OSystem::kFeatureFilteringMode);
+ shouldSelect = isFeatureEnabled ? kOptionLeft : kOptionRight;
+
+ g_system->delayMillis(1000);
+
+ prompt = " Which mode do you see now ? ";
+
+ if (!Testsuite::handleInteractiveInput(prompt, "Filtered", "Unfiltered", shouldSelect)) {
+ // User selected incorrect mode
+ passed = kTestFailed;
+ Testsuite::logDetailedPrintf("g_system->setFeatureState() failed\n");
+ }
+
+ g_system->beginGFXTransaction();
+ g_system->setFeatureState(OSystem::kFeatureFilteringMode, !isFeatureEnabled);
+ g_system->endGFXTransaction();
+
+ g_system->delayMillis(1000);
+
+ prompt = "This should be your initial state. Is it?";
+
+ if (!Testsuite::handleInteractiveInput(prompt, "Yes, it is", "Nopes", kOptionLeft)) {
+ // User selected incorrect mode
+ Testsuite::logDetailedPrintf("switching back to initial state failed\n");
+ passed = kTestFailed;
+ }
+
+ // Restore fullscreen state
+ if (fullScreenToggled) {
+ g_system->beginGFXTransaction();
+ g_system->setFeatureState(OSystem::kFeatureFullscreenMode, false);
+ g_system->endGFXTransaction();
+ }
+
+ } else {
+ Testsuite::displayMessage("feature not supported");
+ }
+
+ return passed;
+}
+
+/**
* Tests the aspect ratio correction by: drawing an ellipse, when corrected the ellipse should render to a circle
*/
TestExitStatus GFXtests::aspectRatio() {
@@ -626,9 +751,12 @@ TestExitStatus GFXtests::mouseMovements() {
g_system->updateScreen();
g_system->delayMillis(1000);
+ Common::Event event;
+
for (int i = 0; i <= 100; i++) {
g_system->delayMillis(20);
g_system->warpMouse(i, i);
+ g_system->getEventManager()->pollEvent(event);
g_system->updateScreen();
}