[Scummvm-cvs-logs] SF.net SVN: scummvm:[49668] scummvm/branches/gsoc2010-testbed/engines/ testbed

sud03r at users.sourceforge.net sud03r at users.sourceforge.net
Mon Jun 14 22:15:16 CEST 2010


Revision: 49668
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49668&view=rev
Author:   sud03r
Date:     2010-06-14 20:15:15 +0000 (Mon, 14 Jun 2010)

Log Message:
-----------
added some features suggested by jordi, needs more work although

Modified Paths:
--------------
    scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp
    scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.h
    scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.h

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp	2010-06-14 19:55:08 UTC (rev 49667)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp	2010-06-14 20:15:15 UTC (rev 49668)
@@ -48,23 +48,6 @@
 	g_system->grabPalette(_palette, 0, 3);
 }
 
-void GFXTestSuite::execute() {
-	for (Common::Array<Test*>::iterator i = _testsToExecute.begin(); i != _testsToExecute.end(); ++i) {
-		printf("Executing Test:%s\n", ((*i)->featureName).c_str());
-		// Invoke the test
-		(*i)->driver();
-		_numTestsExecuted++;
-		// Verify result by Interacting with the tester.
-		Common::String prompt("Was this similar to what you expected?");
-		if (handleInteractiveInput(prompt)) {
-			_numTestsPassed++;
-		}
-	}
-
-	// Report Generation
-	genReport();
-}
-
 // Helper functions used by GFX tests
 
 void GFXtests::drawCursor(const char *gfxModeName, int cursorTargetScale) {
@@ -84,7 +67,7 @@
 			buffer[9 - i][i] = 0;
 		}
 	
-		CursorMan.pushCursorPalette(palette, 0, 3);
+		CursorMan.replaceCursorPalette(palette, 0, 3);
 		CursorMan.pushCursor(&buffer[0][0], 10, 10, 5, 5, cursorTargetScale);
 		CursorMan.showMouse(true);
 		g_system->updateScreen();
@@ -158,37 +141,72 @@
 
 bool GFXtests::fullScreenMode() {
 	
-	Testsuite::displayMessage("Testing fullscreen mode.\n" 
-	"If the feature is supported by the backend, you should expect to see a toggle between fullscreen and normal modes");
-
 	Common::Point pt(0, 100);
 	Common::Rect rect = Testsuite::writeOnScreen("Testing fullscreen mode", pt);
 	
 	bool isFeaturePresent;
 	bool isFeatureEnabled;
+	bool passed = true;
+	Common::String prompt;
+	OptionSelected shouldSelect;
 
 	isFeaturePresent = g_system->hasFeature(OSystem::kFeatureFullscreenMode);
-	isFeatureEnabled = g_system->getFeatureState(OSystem::kFeatureFullscreenMode);
-	g_system->delayMillis(1000);
 
 	if (isFeaturePresent) {
 		// Toggle
+		isFeatureEnabled = g_system->getFeatureState(OSystem::kFeatureFullscreenMode);
+		shouldSelect = isFeatureEnabled ? kOptionLeft : kOptionRight;
+		
+		if (isFeatureEnabled) {
+			printf("LOG: Current Mode is Fullsecreen\n");
+		} else {
+			printf("LOG: Current Mode is Windowed\n");
+		}
 
+		prompt = " Which mode do you see currently ?  ";
+		
+		if (!Testsuite::handleInteractiveInput(prompt, "Fullscreen", "Windowed", shouldSelect)) {
+			// User selected incorrect current state
+			passed = false;
+			printf("LOG: g_system->getFeatureState() failed\n");
+		}
+
 		g_system->beginGFXTransaction();
 		g_system->setFeatureState(OSystem::kFeatureFullscreenMode, !isFeatureEnabled);
 		g_system->endGFXTransaction();
 
+		// Current state should be now !isFeatureEnabled
+		isFeatureEnabled = g_system->getFeatureState(OSystem::kFeatureFullscreenMode);
+		shouldSelect = isFeatureEnabled ? kOptionLeft : kOptionRight;
+			
 		g_system->delayMillis(1000);
 		
+		prompt = " Which mode do you see now ?  ";
+		
+		if (!Testsuite::handleInteractiveInput(prompt, "Fullscreen", "Windowed", shouldSelect)) {
+			// User selected incorrect mode
+			passed = false;
+			printf("LOG: g_system->setFeatureState() failed\n");
+		}
+		
 		g_system->beginGFXTransaction();
-		g_system->setFeatureState(OSystem::kFeatureFullscreenMode, isFeatureEnabled);
+		g_system->setFeatureState(OSystem::kFeatureFullscreenMode, !isFeatureEnabled);
 		g_system->endGFXTransaction();
+		
+		prompt = "This should be your initial state.Is it?";
+		
+		if (!Testsuite::handleInteractiveInput(prompt, "Yes, it is", "Nopes", shouldSelect)) {
+			// User selected incorrect mode
+			printf("LOG: switching back to initial state failed\n");
+			passed = false;
+		}
+
 	} else {
 		Testsuite::displayMessage("feature not supported");
 	}
 
-	Testsuite::clearScreen(rect);
-	return true;
+	Testsuite::clearScreen();
+	return passed;
 }
 
 /**
@@ -196,18 +214,18 @@
  */
 
 bool GFXtests::aspectRatio() {
-	Testsuite::displayMessage("Testing Aspect Ratio Correction.\n"
-	"With this feature enabled games running at 320x200 should be scaled upto 320x240 pixels");
-
 	// Draw an ellipse on the screen
 	
 	drawEllipse(100, 160, 72, 60);
 	
 	Common::Point pt(0, 180);
-	Testsuite::writeOnScreen("when corrected, it should be a circle!", pt);
+	Testsuite::writeOnScreen("Testing Aspect Ratio Correction!", pt);
 	
 	bool isFeaturePresent;
 	bool isFeatureEnabled;
+	bool passed;
+	Common::String prompt;
+	OptionSelected shouldSelect;
 
 	isFeaturePresent = g_system->hasFeature(OSystem::kFeatureAspectRatioCorrection);
 	isFeatureEnabled = g_system->getFeatureState(OSystem::kFeatureAspectRatioCorrection);
@@ -215,13 +233,28 @@
 
 	if (isFeaturePresent) {
 		// Toggle
-
+		shouldSelect = isFeatureEnabled ? kOptionLeft : kOptionRight;
+		prompt = " What does the curve on screen appears to you ?";
+		if (!Testsuite::handleInteractiveInput(prompt, "Circle", "Ellipse", shouldSelect)) {
+			// User selected incorrect option
+			passed = false;
+			printf("LOG: Aspect Ratio Correction failed\n");
+		}
+		
 		g_system->beginGFXTransaction();
 		g_system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, !isFeatureEnabled);
 		g_system->endGFXTransaction();
-
+		
 		g_system->delayMillis(1000);
 		
+		shouldSelect = !isFeatureEnabled ? kOptionLeft : kOptionRight;
+		prompt = " What does the curve on screen appears to you ?";
+		if (!Testsuite::handleInteractiveInput(prompt, "Circle", "Ellipse", shouldSelect)) {
+			// User selected incorrect option
+			passed = false;
+			printf("LOG: Aspect Ratio Correction failed\n");
+		}
+		
 		g_system->beginGFXTransaction();
 		g_system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, isFeatureEnabled);
 		g_system->endGFXTransaction();
@@ -231,7 +264,7 @@
 
 	g_system->delayMillis(500);
 	Testsuite::clearScreen();
-	return true;
+	return passed;
 }
 
 /**
@@ -246,15 +279,30 @@
 	Common::Point pt(0, 100);
 	
 	bool isFeaturePresent;
-	bool isFeatureEnabled;
+	bool passed = true;
 
 	isFeaturePresent = g_system->hasFeature(OSystem::kFeatureCursorHasPalette);
-	isFeatureEnabled = g_system->getFeatureState(OSystem::kFeatureCursorHasPalette);
 
 	if (isFeaturePresent) {
+		Testsuite::writeOnScreen("Testing Palettized Cursors", pt);
+		
+		// Cursor palette is Black(0), White(1), yellow(2)
 		GFXtests::drawCursor();
+		// Change screen Palette color-value 2 to red
+		// This function exactly does this job
+		GFXTestSuite::setCustomColor(255, 0, 0);
+		// Now disable palette
+		CursorMan.disableCursorPalette(true);
+		g_system->updateScreen();
+		g_system->delayMillis(1000);
+		if (Testsuite::handleInteractiveInput("Which color does cursor appears to you?", "Yellow", "Red", kOptionRight)) {
+			printf("LOG: Couldn't use game palette for rendering cursor\n");
+			passed = false;
+		}
 		
-		Testsuite::writeOnScreen("Testing Palettized Cursors", pt);
+		// Now enable cursor palette
+		CursorMan.disableCursorPalette(false);
+		GFXtests::drawCursor();
 		
 		Common::EventManager *eventMan = g_system->getEventManager();
 		Common::Event event;
@@ -318,7 +366,10 @@
 	CursorMan.popCursor();
 
 	Testsuite::clearScreen();
-	return true;
+	if (!Testsuite::handleInteractiveInput("Did it went as you were expecting?")) {
+		passed = false;
+	}
+	return passed;
 }
 
 

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.h
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.h	2010-06-14 19:55:08 UTC (rev 49667)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.h	2010-06-14 20:15:15 UTC (rev 49668)
@@ -36,7 +36,6 @@
 	 */
 	GFXTestSuite();
 	~GFXTestSuite(){}
-	void execute();
 	const char *getName() const;
 	static void setCustomColor(uint r, uint g, uint b);
 

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.h
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.h	2010-06-14 19:55:08 UTC (rev 49667)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.h	2010-06-14 20:15:15 UTC (rev 49668)
@@ -18,6 +18,11 @@
 	kColorCustom = 2
 };
 
+enum OptionSelected {
+	kOptionLeft = 1,
+	kOptionRight = 0
+};
+
 typedef bool (*InvokingFunction)();
 
 /**
@@ -68,12 +73,12 @@
 	 * @param	textToDisplay Display text
 	 * @return	true if "Yes" false otherwise
 	 */ 
-	static bool handleInteractiveInput(const Common::String &textToDisplay) {
-		GUI::MessageDialog	prompt(textToDisplay, "Yes", "No");
-		return prompt.runModal() == GUI::kMessageOK ? true : false;
+	static bool handleInteractiveInput(const Common::String &textToDisplay, const char *opt1 = "Yes", const char *opt2 = "No", OptionSelected result = kOptionLeft) {
+		GUI::MessageDialog	prompt(textToDisplay, opt1, opt2);
+		return prompt.runModal() == result ? true : false;
 	}
 	
-	static void displayMessage(const Common::String &textToDisplay, const char *defaultButton = "OK", const char *altButton = 0 ) {
+	static void displayMessage(const Common::String &textToDisplay, const char *defaultButton = "OK", const char *altButton = 0) {
 		GUI::MessageDialog	prompt(textToDisplay, defaultButton);
 		prompt.runModal();
 	}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list