Mercurial > sdl-ios-xcode
diff test/automated/rwops/rwops.c @ 4451:033c455bbe99
Refactored automated rwops tests so read and write directories can be more easily customized.
The refactored tests were written in recognition that Mac and iPhone current working directories are usually not going to work. Resource directories are in bundles and write directories are restricted to certain areas. In theory, other platforms may have this problem too, hence the refactoring.
Also updated the Xcode iPhone project to use 3.2 as the Base SDK, but 3.1 as the Deployment SDK (for iPhone/iPad compatibility.)
author | Eric Wing <ewing . public |-at-| gmail . com> |
---|---|
date | Sun, 09 May 2010 06:58:30 -0700 |
parents | 8f73f4a3c972 |
children |
line wrap: on
line diff
--- a/test/automated/rwops/rwops.c Sat May 08 08:23:46 2010 -0700 +++ b/test/automated/rwops/rwops.c Sun May 09 06:58:30 2010 -0700 @@ -9,17 +9,11 @@ #include "SDL.h" #include "../SDL_at.h" -#if __APPLE__ -#include "Test_rwopsbundlesupport.h" -#endif - -#define RWOPS_READ "rwops/read" +#include "TestSupportRWops.h" -#if __APPLE__ -#define RWOPS_WRITE "write" -#else -#define RWOPS_WRITE "rwops/write" -#endif +/* Defined in TestSupportRWops implementation to allow flexibility. */ +extern const char* RWOPS_READ; +extern const char* RWOPS_WRITE; static const char hello_world[] = "Hello World!"; @@ -193,16 +187,16 @@ SDL_ATbegin( "SDL_RWFromFile" ); /* Read test. */ - rw = SDL_RWFromFile( RWOPS_READ, "r" ); - if (SDL_ATassert( "Opening memory with SDL_RWFromFile '"RWOPS_READ"'", rw != NULL )) + rw = TestSupportRWops_OpenRWopsFromReadDir( RWOPS_READ, "r" ); + if (SDL_ATassert( "Opening memory with SDL_RWFromFile RWOPS_READ", rw != NULL )) return; if (rwops_testGeneric( rw, 0 )) return; SDL_FreeRW( rw ); /* Write test. */ - rw = SDL_RWFromFile( RWOPS_WRITE, "w+" ); - if (SDL_ATassert( "Opening memory with SDL_RWFromFile '"RWOPS_WRITE"'", rw != NULL )) + rw = TestSupportRWops_OpenRWopsFromWriteDir( RWOPS_WRITE, "w+" ); + if (SDL_ATassert( "Opening memory with SDL_RWFromFile RWOPS_WRITE", rw != NULL )) return; if (rwops_testGeneric( rw, 1 )) return; @@ -226,12 +220,8 @@ SDL_ATbegin( "SDL_RWFromFP" ); /* Run read tests. */ -#if __APPLE__ - fp = Test_OpenFPFromBundleOrFallback( RWOPS_READ, "r" ); -#else - fp = fopen( RWOPS_READ, "r" ); -#endif - if (SDL_ATassert( "Failed to open file '"RWOPS_READ"'", fp != NULL)) + fp = TestSupportRWops_OpenFPFromReadDir( RWOPS_READ, "r" ); + if (SDL_ATassert( "Failed to open file 'WOPS_READ", fp != NULL)) return; rw = SDL_RWFromFP( fp, 1 ); if (SDL_ATassert( "Opening memory with SDL_RWFromFP", rw != NULL )) @@ -241,12 +231,8 @@ SDL_FreeRW( rw ); /* Run write tests. */ -#if __APPLE__ - fp = Test_OpenFPFromTemporaryDir( RWOPS_WRITE, "w+" ); -#else - fp = fopen( RWOPS_WRITE, "w+" ); -#endif - if (SDL_ATassert( "Failed to open file '"RWOPS_WRITE"'", fp != NULL)) + fp = TestSupportRWops_OpenFPFromWriteDir( RWOPS_WRITE, "w+" ); + if (SDL_ATassert( "Failed to open file RWOPS_WRITE", fp != NULL)) return; rw = SDL_RWFromFP( fp, 1 ); if (SDL_ATassert( "Opening memory with SDL_RWFromFP", rw != NULL ))