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

sud03r at users.sourceforge.net sud03r at users.sourceforge.net
Thu Jun 10 14:40:58 CEST 2010


Revision: 49571
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49571&view=rev
Author:   sud03r
Date:     2010-06-10 12:40:58 +0000 (Thu, 10 Jun 2010)

Log Message:
-----------
some minor changes in the testsuite structure, reduced no. of files per testsuite, fixed some formatting

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

Removed Paths:
-------------
    scummvm/branches/gsoc2010-testbed/engines/testbed/gfxtests.cpp
    scummvm/branches/gsoc2010-testbed/engines/testbed/gfxtests.h

Deleted: scummvm/branches/gsoc2010-testbed/engines/testbed/gfxtests.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/gfxtests.cpp	2010-06-10 11:43:20 UTC (rev 49570)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/gfxtests.cpp	2010-06-10 12:40:58 UTC (rev 49571)
@@ -1,180 +0,0 @@
-#include "testbed/gfxtests.h"
-#include "testbed/graphics.h"
-#include "testbed/testsuite.h"
-
-#include "graphics/fontman.h"
-#include "graphics/surface.h"
-#include "graphics/cursorman.h"
-
-#include "common/events.h"
-
-namespace Testbed {
-
-bool testFullScreenMode() {
-
-	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;
-
-	isFeaturePresent = g_system->hasFeature(OSystem::kFeatureFullscreenMode);
-	isFeatureEnabled = g_system->getFeatureState(OSystem::kFeatureFullscreenMode);
-	g_system->delayMillis(1000);
-
-	if (isFeaturePresent) {
-		//Toggle
-
-		g_system->beginGFXTransaction();
-		g_system->setFeatureState(OSystem::kFeatureFullscreenMode, !isFeatureEnabled);
-		g_system->endGFXTransaction();
-
-		g_system->delayMillis(1000);
-		
-		g_system->beginGFXTransaction();
-		g_system->setFeatureState(OSystem::kFeatureFullscreenMode, isFeatureEnabled);
-		g_system->endGFXTransaction();
-	}
-	else {
-		Testsuite::displayMessage("feature not supported");
-	}
-
-	Testsuite::clearScreen(rect);
-	return true;
-}
-
-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 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);
-	
-	bool isFeaturePresent;
-	bool isFeatureEnabled;
-
-	isFeaturePresent = g_system->hasFeature(OSystem::kFeatureCursorHasPalette);
-	isFeatureEnabled = g_system->getFeatureState(OSystem::kFeatureCursorHasPalette);
-
-	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, 45, 45, 1);
-		CursorMan.showMouse(true);
-
-		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");
-	}
-	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;
-
-}
-
-	
-}

Deleted: scummvm/branches/gsoc2010-testbed/engines/testbed/gfxtests.h
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/gfxtests.h	2010-06-10 11:43:20 UTC (rev 49570)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/gfxtests.h	2010-06-10 12:40:58 UTC (rev 49571)
@@ -1,15 +0,0 @@
-#ifndef GFXTESTS_H
-#define GFXTESTS_H
-
-namespace Testbed {
-
-// will contain function declarations for GFX tests
-bool testFullScreenMode(); 
-bool testAspectRatio();
-bool testPalettizedCursors();
-bool testCopyRectToScreen();
-// add more here
-
-}
-
-#endif

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp	2010-06-10 11:43:20 UTC (rev 49570)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp	2010-06-10 12:40:58 UTC (rev 49571)
@@ -1,22 +1,28 @@
+#include "common/events.h"
+
 #include "testbed/graphics.h"
-#include "testbed/gfxtests.h"
+#include "testbed/testsuite.h"
 
+#include "graphics/cursorman.h"
+#include "graphics/fontman.h"
+#include "graphics/surface.h"
+
 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
+	// The fourth field is for alpha channel which is unused
 	// Assuming 8bpp as of now
 	g_system->setPalette(_palette, 0, 3);
 	g_system->grabPalette(_palette, 0, 3);
 	
 	// Add tests here
-	addTest("FullScreenMode", &testFullScreenMode);
-	addTest("AspectRatio", &testAspectRatio);
-	addTest("PalettizedCursors", &testPalettizedCursors);
-	addTest("BlitBitmaps", &testCopyRectToScreen);
+	addTest("FullScreenMode", &GFXtests::fullScreenMode);
+	addTest("AspectRatio", &GFXtests::aspectRatio);
+	addTest("PalettizedCursors", &GFXtests::palettizedCursors);
+	addTest("BlitBitmaps", &GFXtests::copyRectToScreen);
 }
 
 const char *GFXTestSuite::getName() {
@@ -48,4 +54,175 @@
 	genReport();
 }
 
+// GFXtests go here
+
+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;
+
+	isFeaturePresent = g_system->hasFeature(OSystem::kFeatureFullscreenMode);
+	isFeatureEnabled = g_system->getFeatureState(OSystem::kFeatureFullscreenMode);
+	g_system->delayMillis(1000);
+
+	if (isFeaturePresent) {
+		// Toggle
+
+		g_system->beginGFXTransaction();
+		g_system->setFeatureState(OSystem::kFeatureFullscreenMode, !isFeatureEnabled);
+		g_system->endGFXTransaction();
+
+		g_system->delayMillis(1000);
+		
+		g_system->beginGFXTransaction();
+		g_system->setFeatureState(OSystem::kFeatureFullscreenMode, isFeatureEnabled);
+		g_system->endGFXTransaction();
+	}
+	else {
+		Testsuite::displayMessage("feature not supported");
+	}
+
+	Testsuite::clearScreen(rect);
+	return true;
 }
+
+bool GFXtests::aspectRatio() {
+	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 GFXtests::palettizedCursors() {
+	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);
+	
+	bool isFeaturePresent;
+	bool isFeatureEnabled;
+
+	isFeaturePresent = g_system->hasFeature(OSystem::kFeatureCursorHasPalette);
+	isFeatureEnabled = g_system->getFeatureState(OSystem::kFeatureCursorHasPalette);
+
+	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, 45, 45, 1);
+		CursorMan.showMouse(true);
+
+		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");
+	}
+	Testsuite::clearScreen(rect);
+	return true;
+}
+
+bool GFXtests::mouseMovements() {
+	return true;
+}
+
+bool GFXtests::copyRectToScreen() {
+	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;
+
+}
+
+}

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.h
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.h	2010-06-10 11:43:20 UTC (rev 49570)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.h	2010-06-10 12:40:58 UTC (rev 49571)
@@ -5,6 +5,16 @@
 
 namespace Testbed {
 
+namespace GFXtests {
+// will contain function declarations for GFX tests
+bool fullScreenMode(); 
+bool aspectRatio();
+bool palettizedCursors();
+bool copyRectToScreen();
+bool mouseMovements();
+// add more here
+}
+
 class GFXTestSuite : public Testsuite {
 public:
 	/**

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/module.mk
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/module.mk	2010-06-10 11:43:20 UTC (rev 49570)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/module.mk	2010-06-10 12:40:58 UTC (rev 49571)
@@ -3,7 +3,6 @@
 MODULE_OBJS := \
 	detection.o \
 	graphics.o \
-	gfxtests.o \
 	testbed.o
  
 MODULE_DIRS += \

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.cpp	2010-06-10 11:43:20 UTC (rev 49570)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/testbed.cpp	2010-06-10 12:40:58 UTC (rev 49571)
@@ -55,11 +55,14 @@
 	// TODO: Implement that
 
 	bool interactive;
-	Common::String prompt("Welcome to the ScummVM testbed! \n \
-						It is a framework to test the various ScummVM subsystems namely GFX, Sound, FS, events etc. \n \
-						If you are seeing this correctly, it means interactive tests would run on this system :)");
-	interactive = Testsuite::handleInteractiveInput(prompt);
+	Common::String prompt("Welcome to the ScummVM testbed!\n"
+						"It is a framework to test the various ScummVM subsystems namely GFX, Sound, FS, events etc.\n"
+						"If you see this, it means interactive tests would run on this system :)");
 
+	// To be set from config file
+	interactive = true;
+	Testsuite::displayMessage(prompt, "proceed?");
+
 	if (interactive) {
 		printf("Running tests in Interactive Mode\n");		
 		// Executing GFX Tests

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.h
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.h	2010-06-10 11:43:20 UTC (rev 49570)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.h	2010-06-10 12:40:58 UTC (rev 49571)
@@ -73,8 +73,8 @@
 		return prompt.runModal() == GUI::kMessageOK ? true : false;
 	}
 	
-	static void displayMessage(const Common::String &textToDisplay) {
-		GUI::MessageDialog	prompt(textToDisplay);
+	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