This repository has been archived by the owner. It is now read-only.
Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
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.)
- Loading branch information
Showing
with
102 additions
and 58 deletions.
- +13 −14 Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj
- +1 −0 test/automated/Makefile
- +14 −0 test/automated/rwops/TestSupportRWops.h
- +34 −7 test/automated/rwops/{Test_rwopsbundlesupport.m → TestSupportRWops_Cocoa.m}
- +28 −0 test/automated/rwops/TestSupportRWops_Generic.c
- +0 −11 test/automated/rwops/Test_rwopsbundlesupport.h
- +12 −26 test/automated/rwops/rwops.c
@@ -0,0 +1,14 @@ | ||
|
||
#include <stdio.h> | ||
#include "SDL.h" | ||
|
||
#ifndef TestSupportRWops_h | ||
#define TestSupportRWops_h | ||
|
||
FILE* TestSupportRWops_OpenFPFromReadDir(const char *file, const char *mode); | ||
FILE* TestSupportRWops_OpenFPFromWriteDir(const char *file, const char *mode); | ||
SDL_RWops* TestSupportRWops_OpenRWopsFromReadDir(const char *file, const char *mode); | ||
SDL_RWops* TestSupportRWops_OpenRWopsFromWriteDir(const char *file, const char *mode); | ||
|
||
|
||
#endif |
@@ -0,0 +1,28 @@ | ||
/* Generic implementation for file opening routines. | ||
* Customizations for specific platforms should go in alternative files. | ||
*/ | ||
#include <stdio.h> | ||
#include "SDL.h" | ||
|
||
const char* RWOPS_READ = "rwops/read"; | ||
const char* RWOPS_WRITE = "rwops/write"; | ||
|
||
FILE* TestSupportRWops_OpenFPFromReadDir(const char *file, const char *mode) | ||
{ | ||
return fopen(file, mode); | ||
} | ||
|
||
FILE* TestSupportRWops_OpenFPFromWriteDir(const char *file, const char *mode) | ||
{ | ||
return fopen(file, mode); | ||
} | ||
|
||
SDL_RWops* TestSupportRWops_OpenRWopsFromReadDir(const char *file, const char *mode) | ||
{ | ||
return SDL_RWFromFile(file, mode); | ||
} | ||
|
||
SDL_RWops* TestSupportRWops_OpenRWopsFromWriteDir(const char *file, const char *mode) | ||
{ | ||
return SDL_RWFromFile(file, mode); | ||
} |