From 79d636ba8a34a3dd5942cd61933940bbc4c87541 Mon Sep 17 00:00:00 2001 From: sluicebox Date: Sun, 17 Nov 2019 15:01:29 -0800 Subject: TESTBED: Add horizontal/diagonal shake tests --- engines/testbed/graphics.cpp | 53 ++++++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 14 deletions(-) (limited to 'engines/testbed') diff --git a/engines/testbed/graphics.cpp b/engines/testbed/graphics.cpp index 1eac3a8ffb..9fa06de9b6 100644 --- a/engines/testbed/graphics.cpp +++ b/engines/testbed/graphics.cpp @@ -977,23 +977,48 @@ TestExitStatus GFXtests::shakingEffect() { return kTestSkipped; } + // test vertical, horizontal, and diagonal Common::Point pt(0, 100); - Testsuite::writeOnScreen("If Shaking Effect works, this should shake!", pt); - int times = 15; - while (times--) { - g_system->setShakePos(25, 25); - g_system->delayMillis(50); - g_system->updateScreen(); - g_system->setShakePos(0, 0); - g_system->delayMillis(50); - g_system->updateScreen(); - } - g_system->delayMillis(1500); + for (int i = 0; i < 3; ++i) { + Common::String direction; + int shakeXOffset; + int shakeYOffset; + switch (i) { + case 0: + direction = "vertical"; + shakeXOffset = 0; + shakeYOffset = 25; + break; + case 1: + direction = "horizontal"; + shakeXOffset = 25; + shakeYOffset = 0; + break; + default: + direction = "diagonal"; + shakeXOffset = 25; + shakeYOffset = 25; + break; + } - if (Testsuite::handleInteractiveInput("Did the Shaking test worked as you were expecting?", "Yes", "No", kOptionRight)) { - Testsuite::logDetailedPrintf("Shaking Effect didn't worked"); - return kTestFailed; + Testsuite::writeOnScreen(Common::String::format("If Shaking Effect works, this should shake %s", direction.c_str()), pt); + int times = 15; + while (times--) { + g_system->setShakePos(shakeXOffset, shakeYOffset); + g_system->delayMillis(50); + g_system->updateScreen(); + g_system->setShakePos(0, 0); + g_system->delayMillis(50); + g_system->updateScreen(); + } + g_system->delayMillis(1500); + + if (Testsuite::handleInteractiveInput("Did the Shaking test work as you were expecting?", "Yes", "No", kOptionRight)) { + Testsuite::logDetailedPrintf("Shaking Effect didn't work"); + return kTestFailed; + } } + return kTestPassed; } -- cgit v1.2.3