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

sud03r at users.sourceforge.net sud03r at users.sourceforge.net
Tue Jun 8 22:24:54 CEST 2010


Revision: 49516
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49516&view=rev
Author:   sud03r
Date:     2010-06-08 20:24:54 +0000 (Tue, 08 Jun 2010)

Log Message:
-----------
added working test for palettized cursors, tests mouse events as well

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

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/gfxtests.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/gfxtests.cpp	2010-06-08 20:21:08 UTC (rev 49515)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/gfxtests.cpp	2010-06-08 20:24:54 UTC (rev 49516)
@@ -6,6 +6,8 @@
 #include "graphics/surface.h"
 #include "graphics/cursorman.h"
 
+#include "common/events.h"
+
 namespace Testbed {
 
 bool testFullScreenMode() {
@@ -80,7 +82,8 @@
 }
 
 bool testPalettizedCursors() {
-	Testsuite::displayMessage("Testing Cursors. You should expect to see a red colored cursor.\n");
+	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");
 	
 	Common::Point pt(0,100);
 	Common::Rect rect = Testsuite::writeOnScreen("Testing Palettized Cursors", pt);
@@ -90,7 +93,6 @@
 
 	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
@@ -103,9 +105,47 @@
 		memset(buffer, 2, 10 * 10);
 		
 		CursorMan.pushCursorPalette(palette, 0, 3);
-		CursorMan.pushCursor(buffer, 10, 10, 40, 40, 2, 1);
+		CursorMan.pushCursor(buffer, 10, 10, 45, 45, 1);
 		CursorMan.showMouse(true);
-		g_system->updateScreen();
+
+		Common::EventManager *eventMan = g_system->getEventManager();
+		Common::Event event;
+
+		bool quitLoop = false;
+		uint32 lastRedraw = 0;
+		const uint32 waitTime = 1000 / 45;
+
+		while (!quitLoop) {
+			while (eventMan->pollEvent(event)) {
+	
+				 if (lastRedraw + waitTime < g_system->getMillis()) {
+        	        g_system->updateScreen();
+            	    lastRedraw = g_system->getMillis();
+           		 }
+
+				switch (event.type) {
+				case Common::EVENT_MOUSEMOVE:
+					printf("Mouse Move\n");
+					break;
+				case Common::EVENT_LBUTTONDOWN:
+				case Common::EVENT_RBUTTONDOWN:
+					Testsuite::clearScreen(rect);
+					Testsuite::writeOnScreen("Mouse Clicked", pt);
+					printf("Mouse Clicked\n");
+					g_system->delayMillis(1000);
+					quitLoop = true;
+					CursorMan.popCursorPalette();
+					CursorMan.popCursor();
+					Testsuite::clearScreen(rect);
+					Testsuite::writeOnScreen("TestFinished", pt);
+					g_system->delayMillis(1000);
+					break;
+				default:	
+					;//Ignore any other event
+
+				}
+			}
+		}
 	}
 	else {
 		Testsuite::displayMessage("feature not supported");

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp	2010-06-08 20:21:08 UTC (rev 49515)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp	2010-06-08 20:24:54 UTC (rev 49516)
@@ -13,10 +13,10 @@
 	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);
+	addTest("BlitBitmaps", &testCopyRectToScreen);
 }
 
 const char *GFXTestSuite::getName() {


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