From 31caa9748b41aad301151b018d3aef5bfd267c64 Mon Sep 17 00:00:00 2001 From: Andreas Schiffler Date: Sun, 30 Dec 2012 10:58:18 -0800 Subject: [PATCH] Add missing VS project dependencies to fix buildbot build; fix surface suite; minor update to rwops suite --- VisualC/SDL_VS2010.sln | 5 ++ VisualC/SDL_VS2012.sln | 5 ++ .../testautomation_vs2010.vcxproj | 18 ++++ .../testautomation_vs2012.vcxproj | 18 ++++ test/testautomation_rwops.c | 22 ++--- test/testautomation_surface.c | 89 +++++++++++-------- 6 files changed, 111 insertions(+), 46 deletions(-) diff --git a/VisualC/SDL_VS2010.sln b/VisualC/SDL_VS2010.sln index 7a9fe66fb..0a65eaf10 100644 --- a/VisualC/SDL_VS2010.sln +++ b/VisualC/SDL_VS2010.sln @@ -67,6 +67,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDLtest", "SDLtest\SDLtest_ EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testautomation", "tests\testautomation\testautomation_vs2010.vcxproj", "{FEE710DB-EC7B-4CCB-BD75-535D401A2FE0}" + ProjectSection(ProjectDependencies) = postProject + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} + {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A} = {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A} + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/VisualC/SDL_VS2012.sln b/VisualC/SDL_VS2012.sln index 5137db526..7ed51998d 100644 --- a/VisualC/SDL_VS2012.sln +++ b/VisualC/SDL_VS2012.sln @@ -67,6 +67,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDLtest", "SDLtest\SDLtest_ EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testautomation", "tests\testautomation\testautomation_vs2012.vcxproj", "{FEE710DB-EC7B-4CCB-BD75-535D401A2FE0}" + ProjectSection(ProjectDependencies) = postProject + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} + {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A} = {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A} + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/VisualC/tests/testautomation/testautomation_vs2010.vcxproj b/VisualC/tests/testautomation/testautomation_vs2010.vcxproj index 84e16f066..7ecdbc6d4 100644 --- a/VisualC/tests/testautomation/testautomation_vs2010.vcxproj +++ b/VisualC/tests/testautomation/testautomation_vs2010.vcxproj @@ -92,6 +92,12 @@ Windows MachineX86 + + copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL.dll" "$(TargetDir)\SDL.dll" + + + Copy SDL + @@ -136,6 +142,12 @@ true MachineX86 + + copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL.dll" "$(TargetDir)\SDL.dll" + + + Copy SDL + @@ -149,6 +161,12 @@ Level3 ProgramDatabase + + copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL.dll" "$(TargetDir)\SDL.dll" + + + Copy SDL + true diff --git a/VisualC/tests/testautomation/testautomation_vs2012.vcxproj b/VisualC/tests/testautomation/testautomation_vs2012.vcxproj index 25b2eabaa..fbf78157f 100644 --- a/VisualC/tests/testautomation/testautomation_vs2012.vcxproj +++ b/VisualC/tests/testautomation/testautomation_vs2012.vcxproj @@ -96,6 +96,12 @@ Windows MachineX86 + + copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL.dll" "$(TargetDir)\SDL.dll" + + + Copy SDL + @@ -140,6 +146,12 @@ true MachineX86 + + copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL.dll" "$(TargetDir)\SDL.dll" + + + Copy SDL + @@ -160,6 +172,12 @@ true true + + copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL.dll" "$(TargetDir)\SDL.dll" + + + Copy SDL + diff --git a/test/testautomation_rwops.c b/test/testautomation_rwops.c index ff8053dcb..3dc0df66a 100644 --- a/test/testautomation_rwops.c +++ b/test/testautomation_rwops.c @@ -76,7 +76,7 @@ void _testGenericRWopsValidations(SDL_RWops *rw, int write) { char buf[sizeof(RWopsHelloWorldTestString)]; - int i; + Sint64 i; int seekPos = SDLTest_RandomIntegerInRange(4, 8); /* Clear buffer */ @@ -85,33 +85,33 @@ _testGenericRWopsValidations(SDL_RWops *rw, int write) /* Set to start. */ i = SDL_RWseek(rw, 0, RW_SEEK_SET ); SDLTest_AssertPass("Call to SDL_RWseek succeeded"); - SDLTest_AssertCheck(i == 0, "Verify seek to 0 with SDL_RWseek (RW_SEEK_SET), expected 0, got %i", i); + SDLTest_AssertCheck(i == (Sint64)0, "Verify seek to 0 with SDL_RWseek (RW_SEEK_SET), expected 0, got %i", i); /* Test write. */ i = SDL_RWwrite(rw, RWopsHelloWorldTestString, sizeof(RWopsHelloWorldTestString)-1, 1); SDLTest_AssertPass("Call to SDL_RWwrite succeeded"); if (write) { - SDLTest_AssertCheck(i == 1, "Verify result of writing one byte with SDL_RWwrite, expected 1, got %i", i); + SDLTest_AssertCheck(i == (Sint64)1, "Verify result of writing one byte with SDL_RWwrite, expected 1, got %i", i); } else { - SDLTest_AssertCheck(i <= 0, "Verify result of writing with SDL_RWwrite, expected <=0, got %i", i); + SDLTest_AssertCheck(i != (Sint64)1, "Verify result of writing with SDL_RWwrite, expected !=1, got %i", i); } /* Test seek to random position */ i = SDL_RWseek( rw, seekPos, RW_SEEK_SET ); SDLTest_AssertPass("Call to SDL_RWseek succeeded"); - SDLTest_AssertCheck(i == seekPos, "Verify seek to %i with SDL_RWseek (RW_SEEK_SET), expected %i, got %i", seekPos, seekPos, i); + SDLTest_AssertCheck(i == (Sint64)seekPos, "Verify seek to %i with SDL_RWseek (RW_SEEK_SET), expected %i, got %i", seekPos, seekPos, i); /* Test seek back to start */ i = SDL_RWseek(rw, 0, RW_SEEK_SET ); SDLTest_AssertPass("Call to SDL_RWseek succeeded"); - SDLTest_AssertCheck(i == 0, "Verify seek to 0 with SDL_RWseek (RW_SEEK_SET), expected 0, got %i", i); + SDLTest_AssertCheck(i == (Sint64)0, "Verify seek to 0 with SDL_RWseek (RW_SEEK_SET), expected 0, got %i", i); /* Test read */ i = SDL_RWread( rw, buf, 1, sizeof(RWopsHelloWorldTestString)-1 ); SDLTest_AssertPass("Call to SDL_RWread succeeded"); SDLTest_AssertCheck( - i == (sizeof(RWopsHelloWorldTestString)-1), + i == (Sint64)(sizeof(RWopsHelloWorldTestString)-1), "Verify result from SDL_RWread, expected %i, got %i", sizeof(RWopsHelloWorldTestString)-1, i); @@ -123,7 +123,7 @@ _testGenericRWopsValidations(SDL_RWops *rw, int write) i = SDL_RWseek( rw, -4, RW_SEEK_CUR ); SDLTest_AssertPass("Call to SDL_RWseek(...,-4,RW_SEEK_CUR) succeeded"); SDLTest_AssertCheck( - i == (sizeof(RWopsHelloWorldTestString)-5), + i == (Sint64)(sizeof(RWopsHelloWorldTestString)-5), "Verify seek to -4 with SDL_RWseek (RW_SEEK_CUR), expected %i, got %i", sizeof(RWopsHelloWorldTestString)-5, i); @@ -131,7 +131,7 @@ _testGenericRWopsValidations(SDL_RWops *rw, int write) i = SDL_RWseek( rw, -1, RW_SEEK_END ); SDLTest_AssertPass("Call to SDL_RWseek(...,-1,RW_SEEK_END) succeeded"); SDLTest_AssertCheck( - i == (sizeof(RWopsHelloWorldTestString)-2), + i == (Sint64)(sizeof(RWopsHelloWorldTestString)-2), "Verify seek to -1 with SDL_RWseek (RW_SEEK_END), expected %i, got %i", sizeof(RWopsHelloWorldTestString)-2, i); @@ -326,7 +326,7 @@ rwops_testFPRead(void) if (fp == NULL) return TEST_ABORTED; /* Open */ - rw = SDL_RWFromFP( fp, 1 ); + rw = SDL_RWFromFP( fp, SDL_TRUE ); SDLTest_AssertPass("Call to SDL_RWFromFP() succeeded"); SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFP in read mode does not return NULL"); @@ -369,7 +369,7 @@ rwops_testFPWrite(void) if (fp == NULL) return TEST_ABORTED; /* Open */ - rw = SDL_RWFromFP( fp, 1 ); + rw = SDL_RWFromFP( fp, SDL_TRUE ); SDLTest_AssertPass("Call to SDL_RWFromFP() succeeded"); SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFP in write mode does not return NULL"); diff --git a/test/testautomation_surface.c b/test/testautomation_surface.c index c5b919e03..720097982 100644 --- a/test/testautomation_surface.c +++ b/test/testautomation_surface.c @@ -11,34 +11,53 @@ /* ================= Test Case Implementation ================== */ - /* Shared test surface */ -static SDL_Surface *testsurface = NULL; +static SDL_Surface *referenceSurface = NULL; +static SDL_Surface *testSurface = NULL; + +/* Helper functions for the test cases */ + +#define TEST_SURFACE_WIDTH testSurface->w +#define TEST_SURFACE_HEIGHT testSurface->h /* Fixture */ +/* Create a 32-bit writable surface for screen tests */ void _surfaceSetUp(void *arg) { - testsurface = SDLTest_ImageBlit(); - SDLTest_AssertCheck(testsurface != NULL, "Check that testsurface is not NULL"); + Uint32 rmask, gmask, bmask, amask; +#if SDL_BYTEORDER == SDL_BIG_ENDIAN + rmask = 0xff000000; + gmask = 0x00ff0000; + bmask = 0x0000ff00; + amask = 0x000000ff; +#else + rmask = 0x000000ff; + gmask = 0x0000ff00; + bmask = 0x00ff0000; + amask = 0xff000000; +#endif + + referenceSurface = SDLTest_ImageBlit(); /* For size info */ + testSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, referenceSurface->w, referenceSurface->h, 32, rmask, gmask, bmask, amask); + SDLTest_AssertCheck(testSurface != NULL, "Check that testSurface is not NULL"); } void _surfaceTearDown(void *arg) { - if (testsurface != NULL) { - SDL_FreeSurface(testsurface); - testsurface = NULL; + if (referenceSurface != NULL) { + SDL_FreeSurface(referenceSurface); + referenceSurface = NULL; + } + if (testSurface != NULL) { + SDL_FreeSurface(testSurface); + testSurface = NULL; } } -/* Helper functions for the test cases */ - -#define TEST_SURFACE_WIDTH testsurface->w -#define TEST_SURFACE_HEIGHT testsurface->h - /** * Helper that clears the test surface */ @@ -48,9 +67,9 @@ void _clearTestSurface() Uint32 color; /* Clear surface. */ - color = SDL_MapRGB( testsurface->format, 0, 0, 0); + color = SDL_MapRGB( testSurface->format, 0, 0, 0); SDLTest_AssertPass("Call to SDL_MapRGB()"); - ret = SDL_FillRect( testsurface, NULL, color); + ret = SDL_FillRect( testSurface, NULL, color); SDLTest_AssertPass("Call to SDL_FillRect()"); SDLTest_AssertCheck(ret == 0, "Verify result from SDL_FillRect, expected: 0, got: %i", ret); } @@ -64,16 +83,16 @@ void _testBlitBlendMode(int mode) int i, j, ni, nj; SDL_Surface *face; SDL_Rect rect; - Uint32 color; int nmode; + SDL_BlendMode bmode; int checkFailCount1; int checkFailCount2; int checkFailCount3; int checkFailCount4; /* Check test surface */ - SDLTest_AssertCheck(testsurface != NULL, "Verify testsurface is not NULL"); - if (testsurface == NULL) return; + SDLTest_AssertCheck(testSurface != NULL, "Verify testSurface is not NULL"); + if (testSurface == NULL) return; /* Create sample surface */ face = SDLTest_ImageFace(); @@ -88,8 +107,8 @@ void _testBlitBlendMode(int mode) rect.h = face->h; /* Steps to take */ - ni = testsurface->w - face->w; - nj = testsurface->h - face->h; + ni = testSurface->w - face->w; + nj = testSurface->h - face->h; /* Optionally set blend mode. */ if (mode >= 0) { @@ -118,18 +137,18 @@ void _testBlitBlendMode(int mode) else if (mode == -4) { /* Crazy blending mode magic. */ nmode = (i/4*j/4) % 4; - if (nmode==0) nmode = SDL_BLENDMODE_NONE; - else if (nmode==1) nmode = SDL_BLENDMODE_BLEND; - else if (nmode==2) nmode = SDL_BLENDMODE_ADD; - else if (nmode==3) nmode = SDL_BLENDMODE_MOD; - ret = SDL_SetSurfaceBlendMode( face, nmode ); + if (nmode==0) bmode = SDL_BLENDMODE_NONE; + else if (nmode==1) bmode = SDL_BLENDMODE_BLEND; + else if (nmode==2) bmode = SDL_BLENDMODE_ADD; + else if (nmode==3) bmode = SDL_BLENDMODE_MOD; + ret = SDL_SetSurfaceBlendMode( face, bmode ); if (ret != 0) checkFailCount4++; } /* Blitting. */ rect.x = i; rect.y = j; - ret = SDL_BlitSurface( face, NULL, testsurface, &rect ); + ret = SDL_BlitSurface( face, NULL, testSurface, &rect ); if (ret != 0) checkFailCount1++; } } @@ -172,7 +191,7 @@ surface_testSaveLoadBitmap(void *arg) /* Create sample surface */ face = SDLTest_ImageFace(); SDLTest_AssertCheck(face != NULL, "Verify face surface is not NULL"); - if (face == NULL) return; + if (face == NULL) return TEST_ABORTED; /* Delete test file; ignore errors */ unlink(sampleFilename); @@ -231,7 +250,7 @@ surface_testSurfaceConversion(void *arg) } /* Convert to 32 bit to compare. */ - rface = SDL_ConvertSurface( face, testsurface->format, 0 ); + rface = SDL_ConvertSurface( face, testSurface->format, 0 ); SDLTest_AssertPass("Call to SDL_ConvertSurface()"); SDLTest_AssertCheck(rface != NULL, "Verify result from SDL_ConvertSurface is not NULL"); @@ -279,7 +298,7 @@ surface_testBlit(void *arg) /* Verify result by comparing surfaces */ referenceSurface = SDLTest_ImageBlit(); - ret = SDLTest_CompareSurfaces( testsurface, referenceSurface, 0 ); + ret = SDLTest_CompareSurfaces( testSurface, referenceSurface, 0 ); SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret); /* Clean up. */ @@ -304,7 +323,7 @@ surface_testBlitColorMod(void *arg) /* Verify result by comparing surfaces */ referenceSurface = SDLTest_ImageBlitColor(); - ret = SDLTest_CompareSurfaces( testsurface, referenceSurface, 0 ); + ret = SDLTest_CompareSurfaces( testSurface, referenceSurface, 0 ); SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret); /* Clean up. */ @@ -329,7 +348,7 @@ surface_testBlitAlphaMod(void *arg) /* Verify result by comparing surfaces */ referenceSurface = SDLTest_ImageBlitAlpha(); - ret = SDLTest_CompareSurfaces( testsurface, referenceSurface, 0 ); + ret = SDLTest_CompareSurfaces( testSurface, referenceSurface, 0 ); SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret); /* Clean up. */ @@ -355,7 +374,7 @@ surface_testBlitBlendNone(void *arg) /* Verify result by comparing surfaces */ referenceSurface = SDLTest_ImageBlitBlendNone(); - ret = SDLTest_CompareSurfaces( testsurface, referenceSurface, 0 ); + ret = SDLTest_CompareSurfaces( testSurface, referenceSurface, 0 ); SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret); /* Clean up. */ @@ -380,7 +399,7 @@ surface_testBlitBlendBlend(void *arg) /* Verify result by comparing surfaces */ referenceSurface = SDLTest_ImageBlitBlend(); - ret = SDLTest_CompareSurfaces( testsurface, referenceSurface, 0 ); + ret = SDLTest_CompareSurfaces( testSurface, referenceSurface, 0 ); SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret); /* Clean up. */ @@ -405,7 +424,7 @@ surface_testBlitBlendAdd(void *arg) /* Verify result by comparing surfaces */ referenceSurface = SDLTest_ImageBlitBlendAdd(); - ret = SDLTest_CompareSurfaces( testsurface, referenceSurface, 0 ); + ret = SDLTest_CompareSurfaces( testSurface, referenceSurface, 0 ); SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret); /* Clean up. */ @@ -430,7 +449,7 @@ surface_testBlitBlendMod(void *arg) /* Verify result by comparing surfaces */ referenceSurface = SDLTest_ImageBlitBlendMod(); - ret = SDLTest_CompareSurfaces( testsurface, referenceSurface, 0 ); + ret = SDLTest_CompareSurfaces( testSurface, referenceSurface, 0 ); SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret); /* Clean up. */ @@ -455,7 +474,7 @@ surface_testBlitBlendLoop(void *arg) { /* Verify result by comparing surfaces */ referenceSurface = SDLTest_ImageBlitBlendAll(); - ret = SDLTest_CompareSurfaces( testsurface, referenceSurface, 0 ); + ret = SDLTest_CompareSurfaces( testSurface, referenceSurface, 0 ); SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret); /* Clean up. */