changeset 85:35f6cfea565e

Fixed the unit tests so they will now compile and link with msvc2005. There are still a couple more changes needed to run them correctly.
author vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
date Sat, 19 Jul 2008 04:56:28 +0000
parents a19c4ca20d97
children 493f23225972
files build/win32/build_environments/visual_studio_8/unittest_template.xml tests/core_tests/test_gui.cpp tests/core_tests/test_imagepool.cpp tests/core_tests/test_images.cpp tests/core_tests/test_rect.cpp
diffstat 5 files changed, 39 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/build/win32/build_environments/visual_studio_8/unittest_template.xml	Fri Jul 18 21:07:03 2008 +0000
+++ b/build/win32/build_environments/visual_studio_8/unittest_template.xml	Sat Jul 19 04:56:28 2008 +0000
@@ -21,11 +21,11 @@
 			<Tool Name="VCXMLDataGeneratorTool"/>
 			<Tool Name="VCWebServiceProxyGeneratorTool"/>
 			<Tool Name="VCMIDLTool"/>
-			<Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\..\..\..\engine;..\..\..\..\..\engine\core;..\includes;..\..\..\includes\msvc2005\libguichan;..\..\..\includes\msvc2005\libogg;..\..\..\includes\msvc2005\openal-soft;..\..\..\includes\msvc2005\sdl;..\..\..\includes\msvc2005\sdl_image;..\..\..\includes\msvc2005\sdl_ttf;..\..\..\includes\msvc2005\zlib;..\..\..\includes\msvc2005\libvorbis;..\..\..\includes\msvc2005\libpng;..\..\..\includes\msvc2005\python;..\..\..\includes\msvc2005\boost_1_35_0" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="true" DebugInformationFormat="4"/>
+			<Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\..\..\..\engine;..\..\..\..\..\engine\core;..\includes;..\..\..\includes\msvc2005\libguichan;..\..\..\includes\msvc2005\unittest++;..\..\..\includes\msvc2005\libogg;..\..\..\includes\msvc2005\openal-soft;..\..\..\includes\msvc2005\sdl;..\..\..\includes\msvc2005\sdl_image;..\..\..\includes\msvc2005\sdl_ttf;..\..\..\includes\msvc2005\zlib;..\..\..\includes\msvc2005\libvorbis;..\..\..\includes\msvc2005\libpng;..\..\..\includes\msvc2005\python;..\..\..\includes\msvc2005\boost_1_35_0" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="true" DebugInformationFormat="4"/>
 			<Tool Name="VCManagedResourceCompilerTool"/>
 			<Tool Name="VCResourceCompilerTool"/>
 			<Tool Name="VCPreLinkEventTool"/>
-			<Tool Name="VCLinkerTool" LinkIncremental="1" AdditionalDependencies="libfife_d.lib libboost_unit_test_framework-vc80-mt-gd-1_35.lib guichan_opengld.lib guichan_sdld.lib guichand.lib ogg_static_d.lib OpenAL32.lib sdl.lib SDL_image.lib SDL_ttf.lib vorbis_static_d.lib vorbisfile_static_d.lib libpng.lib zlib.lib OpenGL32.lib GLU32.lib" AdditionalLibraryDirectories="..\..\..\static_libs\msvc2005" GenerateDebugInformation="true" SubSystem="1" TargetMachine="1"/>
+			<Tool Name="VCLinkerTool" LinkIncremental="1" AdditionalDependencies="libfife_d.lib UnitTest++.lib guichan_opengld.lib guichan_sdld.lib guichand.lib ogg_static_d.lib OpenAL32.lib sdl.lib SDL_image.lib SDL_ttf.lib vorbis_static_d.lib vorbisfile_static_d.lib libpng.lib zlib.lib OpenGL32.lib GLU32.lib" AdditionalLibraryDirectories="..\..\..\static_libs\msvc2005" GenerateDebugInformation="true" SubSystem="1" TargetMachine="1"/>
 			<Tool Name="VCALinkTool"/>
 			<Tool Name="VCManifestTool"/>
 			<Tool Name="VCXDCMakeTool"/>
@@ -41,11 +41,11 @@
 			<Tool Name="VCXMLDataGeneratorTool"/>
 			<Tool Name="VCWebServiceProxyGeneratorTool"/>
 			<Tool Name="VCMIDLTool"/>
-			<Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\..\..\..\engine;..\..\..\..\..\engine\core;..\includes;..\..\..\includes\msvc2005\libguichan;..\..\..\includes\msvc2005\libogg;..\..\..\includes\msvc2005\openal-soft;..\..\..\includes\msvc2005\sdl;..\..\..\includes\msvc2005\sdl_image;..\..\..\includes\msvc2005\sdl_ttf;..\..\..\includes\msvc2005\zlib;..\..\..\includes\msvc2005\libvorbis;..\..\..\includes\msvc2005\libpng;..\..\..\includes\msvc2005\python25;..\..\..\includes\msvc2005\boost_1_35_0" PreprocessorDefinitions="WIN32;_CONSOLE" MinimalRebuild="true" RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="true" DebugInformationFormat="3"/>
+			<Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\..\..\..\engine;..\..\..\..\..\engine\core;..\includes;..\..\..\includes\msvc2005\libguichan;..\..\..\includes\msvc2005\unittest++;..\..\..\includes\msvc2005\libogg;..\..\..\includes\msvc2005\openal-soft;..\..\..\includes\msvc2005\sdl;..\..\..\includes\msvc2005\sdl_image;..\..\..\includes\msvc2005\sdl_ttf;..\..\..\includes\msvc2005\zlib;..\..\..\includes\msvc2005\libvorbis;..\..\..\includes\msvc2005\libpng;..\..\..\includes\msvc2005\python25;..\..\..\includes\msvc2005\boost_1_35_0" PreprocessorDefinitions="WIN32;_CONSOLE" MinimalRebuild="true" RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="true" DebugInformationFormat="3"/>
 			<Tool Name="VCManagedResourceCompilerTool"/>
 			<Tool Name="VCResourceCompilerTool"/>
 			<Tool Name="VCPreLinkEventTool"/>
-			<Tool Name="VCLinkerTool" LinkIncremental="1" AdditionalDependencies="libfife.lib libboost_unit_test_framework-vc80-mt-1_35.lib guichan_opengl.lib guichan_sdl.lib guichan.lib ogg_static.lib OpenAL32.lib sdl.lib SDL_image.lib SDL_ttf.lib vorbis_static.lib vorbisfile_static.lib libpng.lib zlib.lib OpenGL32.lib GLU32.lib" AdditionalLibraryDirectories="..\..\..\static_libs\msvc2005" SubSystem="1" TargetMachine="1"/>
+			<Tool Name="VCLinkerTool" LinkIncremental="1" AdditionalDependencies="libfife.lib UnitTest++.lib guichan_opengl.lib guichan_sdl.lib guichan.lib ogg_static.lib OpenAL32.lib sdl.lib SDL_image.lib SDL_ttf.lib vorbis_static.lib vorbisfile_static.lib libpng.lib zlib.lib OpenGL32.lib GLU32.lib" AdditionalLibraryDirectories="..\..\..\static_libs\msvc2005" SubSystem="1" TargetMachine="1"/>
 			<Tool Name="VCALinkTool"/>
 			<Tool Name="VCManifestTool"/>
 			<Tool Name="VCXDCMakeTool"/>
--- a/tests/core_tests/test_gui.cpp	Fri Jul 18 21:07:03 2008 +0000
+++ b/tests/core_tests/test_gui.cpp	Sat Jul 19 04:56:28 2008 +0000
@@ -112,7 +112,7 @@
 	RenderBackendSDL renderbackend;
 	renderbackend.init();
 	ImagePool pool;
-	Image* screen = renderbackend.createMainScreen(800, 600, 0, false);
+	Image* screen = renderbackend.createMainScreen(800, 600, 0, false, "FIFE", "");
 	SdlGuiGraphics graphics(pool);
 	graphics.setTarget(screen->getSurface());
 	test_gui_image(renderbackend, graphics, pool);
@@ -124,11 +124,18 @@
 	RenderBackendOpenGL renderbackend;
 	renderbackend.init();
 	ImagePool pool;
-	renderbackend.createMainScreen(800, 600, 0, false);
+	renderbackend.createMainScreen(800, 600, 0, false, "FIFE", "");
 	OpenGLGuiGraphics graphics(pool);
 	test_gui_image(renderbackend, graphics, pool);
 }
 
-int main() {
+// need this here because SDL redefines 
+// main to SDL_main in SDL_main.h
+#ifdef main
+#undef main
+#endif
+
+int main()
+{
 	return UnitTest::RunAllTests();
 }
--- a/tests/core_tests/test_imagepool.cpp	Fri Jul 18 21:07:03 2008 +0000
+++ b/tests/core_tests/test_imagepool.cpp	Sat Jul 19 04:56:28 2008 +0000
@@ -61,23 +61,21 @@
 	boost::shared_ptr<VFS> vfs;
 
 	environment()
-		: timemanager(new TimeManager()) {
+		: timemanager(new TimeManager()), vfs(new VFS()) {
 			if (SDL_Init(SDL_INIT_NOPARACHUTE | SDL_INIT_TIMER) < 0) {	
 				throw SDLException(SDL_GetError());
 			}
 		}
 };
 
-TEST(test_image_pool)
+TEST_FIXTURE(environment, test_image_pool)
 {
-	environment env;
 	RenderBackendSDL renderbackend;
 
-	boost::scoped_ptr<VFS> vfs(new VFS());
 	vfs->addSource(new VFSDirectory(vfs.get()));
 
 	renderbackend.init();
-	renderbackend.createMainScreen(800, 600, 0, false);
+	renderbackend.createMainScreen(800, 600, 0, false, "FIFE", "");
 	ImagePool pool;
 	pool.addResourceLoader(new SubImageLoader());
 	pool.addResourceLoader(new ImageLoader(vfs.get()));
@@ -132,6 +130,15 @@
 	CHECK_EQUAL(0, pool.getResourceCount(RES_NON_LOADED));
 }
 
-int main() {
+// need this here because SDL redefines 
+// main to SDL_main in SDL_main.h
+#ifdef main
+#undef main
+#endif
+
+int main()
+{
 	return UnitTest::RunAllTests();
 }
+
+
--- a/tests/core_tests/test_images.cpp	Fri Jul 18 21:07:03 2008 +0000
+++ b/tests/core_tests/test_images.cpp	Sat Jul 19 04:56:28 2008 +0000
@@ -72,7 +72,7 @@
 
 void test_image(VFS* vfs, RenderBackend& renderbackend) {
 	renderbackend.init();
-	renderbackend.createMainScreen(800, 600, 0, false);
+	renderbackend.createMainScreen(800, 600, 0, false, "FIFE", "");
 
 	ImageLoader provider(vfs);
 	boost::scoped_ptr<Image> img(dynamic_cast<Image*>(provider.loadResource(ImageLocation(IMAGE_FILE))));
@@ -97,7 +97,7 @@
 
 void test_subimage(VFS* vfs, RenderBackend& renderbackend) {
 	renderbackend.init();
-	renderbackend.createMainScreen(800, 600, 0, false);
+	renderbackend.createMainScreen(800, 600, 0, false, "FIFE", "");
 
 	ImageLoader imgprovider(vfs);
 	boost::scoped_ptr<Image> img(dynamic_cast<Image*>(imgprovider.loadResource(ImageLocation(SUBIMAGE_FILE))));
@@ -140,7 +140,7 @@
 	environment env;
 	RenderBackendSDL renderbackend;
 	renderbackend.init();
-	renderbackend.createMainScreen(800, 600, 0, false);
+	renderbackend.createMainScreen(800, 600, 0, false, "FIFE", "");
 	renderbackend.setAlphaOptimizerEnabled(true);
 		
 	ImageLoader provider(env.vfs.get());
@@ -196,6 +196,13 @@
 	test_subimage(env.vfs.get(), renderbackend);
 }
 
-int main() {
+// need this here because SDL redefines 
+// main to SDL_main in SDL_main.h
+#ifdef main
+#undef main
+#endif
+
+int main()
+{
 	return UnitTest::RunAllTests();
 }
--- a/tests/core_tests/test_rect.cpp	Fri Jul 18 21:07:03 2008 +0000
+++ b/tests/core_tests/test_rect.cpp	Sat Jul 19 04:56:28 2008 +0000
@@ -83,6 +83,7 @@
 	}	
 }
 
+
 int main() {
 	return UnitTest::RunAllTests();
 }