Commit 6c9da257 authored by Eric Wing's avatar Eric Wing

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.)

--HG--
rename : test/automated/rwops/Test_rwopsbundlesupport.h => test/automated/rwops/TestSupportRWops.h
rename : test/automated/rwops/Test_rwopsbundlesupport.m => test/automated/rwops/TestSupportRWops_Cocoa.m
parent 4d5a9e42
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
/* End PBXAggregateTarget section */ /* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
001E39A71196EE6F00A3F5B8 /* TestSupportRWops_Cocoa.m in Sources */ = {isa = PBXBuildFile; fileRef = 001E39A51196EE6F00A3F5B8 /* TestSupportRWops_Cocoa.m */; };
006E9852119550FB001DE610 /* audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E9831119550FB001DE610 /* audio.c */; }; 006E9852119550FB001DE610 /* audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E9831119550FB001DE610 /* audio.c */; };
006E9853119550FB001DE610 /* common.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E9834119550FB001DE610 /* common.c */; }; 006E9853119550FB001DE610 /* common.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E9834119550FB001DE610 /* common.c */; };
006E9859119550FB001DE610 /* platform.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E983D119550FB001DE610 /* platform.c */; }; 006E9859119550FB001DE610 /* platform.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E983D119550FB001DE610 /* platform.c */; };
...@@ -42,7 +43,6 @@ ...@@ -42,7 +43,6 @@
006E985C119550FB001DE610 /* render.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E9844119550FB001DE610 /* render.c */; }; 006E985C119550FB001DE610 /* render.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E9844119550FB001DE610 /* render.c */; };
006E985D119550FB001DE610 /* read in Copy rwops */ = {isa = PBXBuildFile; fileRef = 006E9847119550FB001DE610 /* read */; }; 006E985D119550FB001DE610 /* read in Copy rwops */ = {isa = PBXBuildFile; fileRef = 006E9847119550FB001DE610 /* read */; };
006E985E119550FB001DE610 /* rwops.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E9848119550FB001DE610 /* rwops.c */; }; 006E985E119550FB001DE610 /* rwops.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E9848119550FB001DE610 /* rwops.c */; };
006E985F119550FB001DE610 /* Test_rwopsbundlesupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 006E984B119550FB001DE610 /* Test_rwopsbundlesupport.m */; };
006E9860119550FB001DE610 /* SDL_at.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E984C119550FB001DE610 /* SDL_at.c */; }; 006E9860119550FB001DE610 /* SDL_at.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E984C119550FB001DE610 /* SDL_at.c */; };
006E9861119550FB001DE610 /* surface.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E984F119550FB001DE610 /* surface.c */; }; 006E9861119550FB001DE610 /* surface.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E984F119550FB001DE610 /* surface.c */; };
006E9862119550FB001DE610 /* testsdl.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E9851119550FB001DE610 /* testsdl.c */; }; 006E9862119550FB001DE610 /* testsdl.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E9851119550FB001DE610 /* testsdl.c */; };
...@@ -264,6 +264,8 @@ ...@@ -264,6 +264,8 @@
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
001E39A51196EE6F00A3F5B8 /* TestSupportRWops_Cocoa.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestSupportRWops_Cocoa.m; sourceTree = "<group>"; };
001E39A61196EE6F00A3F5B8 /* TestSupportRWops.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestSupportRWops.h; sourceTree = "<group>"; };
006E982211955059001DE610 /* testsdl.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testsdl.app; sourceTree = BUILT_PRODUCTS_DIR; }; 006E982211955059001DE610 /* testsdl.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testsdl.app; sourceTree = BUILT_PRODUCTS_DIR; };
006E982411955059001DE610 /* testsdl-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "testsdl-Info.plist"; sourceTree = "<group>"; }; 006E982411955059001DE610 /* testsdl-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "testsdl-Info.plist"; sourceTree = "<group>"; };
006E9831119550FB001DE610 /* audio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = audio.c; sourceTree = "<group>"; }; 006E9831119550FB001DE610 /* audio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = audio.c; sourceTree = "<group>"; };
...@@ -286,8 +288,6 @@ ...@@ -286,8 +288,6 @@
006E9847119550FB001DE610 /* read */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = read; sourceTree = "<group>"; }; 006E9847119550FB001DE610 /* read */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = read; sourceTree = "<group>"; };
006E9848119550FB001DE610 /* rwops.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rwops.c; sourceTree = "<group>"; }; 006E9848119550FB001DE610 /* rwops.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rwops.c; sourceTree = "<group>"; };
006E9849119550FB001DE610 /* rwops.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rwops.h; sourceTree = "<group>"; }; 006E9849119550FB001DE610 /* rwops.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rwops.h; sourceTree = "<group>"; };
006E984A119550FB001DE610 /* Test_rwopsbundlesupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Test_rwopsbundlesupport.h; sourceTree = "<group>"; };
006E984B119550FB001DE610 /* Test_rwopsbundlesupport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Test_rwopsbundlesupport.m; sourceTree = "<group>"; };
006E984C119550FB001DE610 /* SDL_at.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_at.c; path = ../../test/automated/SDL_at.c; sourceTree = SOURCE_ROOT; }; 006E984C119550FB001DE610 /* SDL_at.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_at.c; path = ../../test/automated/SDL_at.c; sourceTree = SOURCE_ROOT; };
006E984D119550FB001DE610 /* SDL_at.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_at.h; path = ../../test/automated/SDL_at.h; sourceTree = SOURCE_ROOT; }; 006E984D119550FB001DE610 /* SDL_at.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_at.h; path = ../../test/automated/SDL_at.h; sourceTree = SOURCE_ROOT; };
006E984F119550FB001DE610 /* surface.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = surface.c; sourceTree = "<group>"; }; 006E984F119550FB001DE610 /* surface.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = surface.c; sourceTree = "<group>"; };
...@@ -609,11 +609,11 @@ ...@@ -609,11 +609,11 @@
006E9846119550FB001DE610 /* rwops */ = { 006E9846119550FB001DE610 /* rwops */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
001E39A51196EE6F00A3F5B8 /* TestSupportRWops_Cocoa.m */,
001E39A61196EE6F00A3F5B8 /* TestSupportRWops.h */,
006E9847119550FB001DE610 /* read */, 006E9847119550FB001DE610 /* read */,
006E9848119550FB001DE610 /* rwops.c */, 006E9848119550FB001DE610 /* rwops.c */,
006E9849119550FB001DE610 /* rwops.h */, 006E9849119550FB001DE610 /* rwops.h */,
006E984A119550FB001DE610 /* Test_rwopsbundlesupport.h */,
006E984B119550FB001DE610 /* Test_rwopsbundlesupport.m */,
); );
name = rwops; name = rwops;
path = ../../test/automated/rwops; path = ../../test/automated/rwops;
...@@ -694,10 +694,10 @@ ...@@ -694,10 +694,10 @@
29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
006E982F119550E4001DE610 /* TestResources */,
006E982E119550D8001DE610 /* AutomatedTests */,
FD99B8BC0DD52E5C00FB1D6B /* Public Headers */, FD99B8BC0DD52E5C00FB1D6B /* Public Headers */,
FD99B8BD0DD52E6D00FB1D6B /* Library Source */, FD99B8BD0DD52E6D00FB1D6B /* Library Source */,
006E982E119550D8001DE610 /* AutomatedTests */,
006E982F119550E4001DE610 /* TestResources */,
29B97323FDCFA39411CA2CEA /* Frameworks */, 29B97323FDCFA39411CA2CEA /* Frameworks */,
19C28FACFE9D520D11CA2CBB /* Products */, 19C28FACFE9D520D11CA2CBB /* Products */,
006E982411955059001DE610 /* testsdl-Info.plist */, 006E982411955059001DE610 /* testsdl-Info.plist */,
...@@ -1313,10 +1313,10 @@ ...@@ -1313,10 +1313,10 @@
006E985B119550FB001DE610 /* rect.c in Sources */, 006E985B119550FB001DE610 /* rect.c in Sources */,
006E985C119550FB001DE610 /* render.c in Sources */, 006E985C119550FB001DE610 /* render.c in Sources */,
006E985E119550FB001DE610 /* rwops.c in Sources */, 006E985E119550FB001DE610 /* rwops.c in Sources */,
006E985F119550FB001DE610 /* Test_rwopsbundlesupport.m in Sources */,
006E9860119550FB001DE610 /* SDL_at.c in Sources */, 006E9860119550FB001DE610 /* SDL_at.c in Sources */,
006E9861119550FB001DE610 /* surface.c in Sources */, 006E9861119550FB001DE610 /* surface.c in Sources */,
006E9862119550FB001DE610 /* testsdl.c in Sources */, 006E9862119550FB001DE610 /* testsdl.c in Sources */,
001E39A71196EE6F00A3F5B8 /* TestSupportRWops_Cocoa.m in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -1505,15 +1505,15 @@ ...@@ -1505,15 +1505,15 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_C_LANGUAGE_STANDARD = c99; GCC_C_LANGUAGE_STANDARD = c99;
GCC_DEBUGGING_SYMBOLS = full; GCC_DEBUGGING_SYMBOLS = full;
GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = NO; GCC_WARN_UNUSED_VARIABLE = NO;
IPHONEOS_DEPLOYMENT_TARGET = 3.1;
ONLY_ACTIVE_ARCH = NO; ONLY_ACTIVE_ARCH = NO;
PREBINDING = NO; PREBINDING = NO;
SDKROOT = iphoneos3.1.2; SDKROOT = iphoneos3.2;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
}; };
name = Debug; name = Debug;
...@@ -1522,13 +1522,14 @@ ...@@ -1522,13 +1522,14 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)"; ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_C_LANGUAGE_STANDARD = c99; GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = NO; GCC_WARN_UNUSED_VARIABLE = NO;
IPHONEOS_DEPLOYMENT_TARGET = 3.1;
PREBINDING = NO; PREBINDING = NO;
SDKROOT = iphoneos3.1.2; SDKROOT = iphoneos3.2;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
}; };
name = Release; name = Release;
...@@ -1537,7 +1538,6 @@ ...@@ -1537,7 +1538,6 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
DEPLOYMENT_LOCATION = NO; DEPLOYMENT_LOCATION = NO;
...@@ -1553,7 +1553,6 @@ ...@@ -1553,7 +1553,6 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
COPY_PHASE_STRIP = YES; COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
......
...@@ -10,6 +10,7 @@ LDFLAGS := `sdl-config --libs` ...@@ -10,6 +10,7 @@ LDFLAGS := `sdl-config --libs`
SRC := testsdl.c \ SRC := testsdl.c \
platform/platform.c \ platform/platform.c \
rwops/rwops.c \ rwops/rwops.c \
rwops/TestSupportRWops.c \
rect/rect.c \ rect/rect.c \
surface/surface.c \ surface/surface.c \
render/render.c \ render/render.c \
......
#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
#ifdef __APPLE__ #import "TestSupportRWops.h"
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include "SDL.h"
/* For proper OS X applications, the resources are contained inside the application bundle. /* For proper OS X applications, the resources are contained inside the application bundle.
So the strategy is to first check the application bundle for the file, then fallback to the current working directory. So the strategy is to first check the application bundle for the file, then fallback to the current working directory.
Note: One additional corner-case is if the resource is in a framework's resource bundle instead of the app. Note: One additional corner-case is if the resource is in a framework's resource bundle instead of the app.
We might want to use bundle identifiers, e.g. org.libsdl.sdl to get the bundle for the framework, We might want to use bundle identifiers, e.g. org.libsdl.sdl to get the bundle for the framework,
but we would somehow need to know what the bundle identifiers we need to search are. but we would somehow need to know what the bundle identifiers we need to search are.
Conversely, write directories are usually not in the bundles. This implementation uses NSTemporaryDirectory,
but consider Preferences, Application Support, Documents, etc.
Also, note the bundle layouts are different for iPhone and Mac. Also, note the bundle layouts are different for iPhone and Mac.
*/ */
FILE* Test_OpenFPFromBundleOrFallback(const char *file, const char *mode)
const char* RWOPS_READ = "rwops/read";
const char* RWOPS_WRITE = "write";
FILE* TestSupportRWops_OpenFPFromReadDir(const char *file, const char *mode)
{ {
FILE* fp = NULL; FILE* fp = NULL;
...@@ -41,22 +49,41 @@ FILE* Test_OpenFPFromBundleOrFallback(const char *file, const char *mode) ...@@ -41,22 +49,41 @@ FILE* Test_OpenFPFromBundleOrFallback(const char *file, const char *mode)
return fp; return fp;
} }
FILE* Test_OpenFPFromTemporaryDir(const char *file, const char *mode) FILE* TestSupportRWops_OpenFPFromWriteDir(const char *file, const char *mode)
{ {
FILE* fp = NULL; FILE* fp = NULL;
NSAutoreleasePool* autorelease_pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool* autorelease_pool = [[NSAutoreleasePool alloc] init];
NSFileManager* file_manager = [NSFileManager defaultManager]; NSFileManager* file_manager = [NSFileManager defaultManager];
NSString* ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)]; NSString* ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)];
NSString* full_path_with_file_to_try = [NSTemporaryDirectory() stringByAppendingPathComponent:ns_string_file_component]; NSString* full_path_with_file_to_try = [NSTemporaryDirectory() stringByAppendingPathComponent:ns_string_file_component];
fp = fopen([full_path_with_file_to_try fileSystemRepresentation], mode); fp = fopen([full_path_with_file_to_try fileSystemRepresentation], mode);
[autorelease_pool drain]; [autorelease_pool drain];
return fp; return fp;
} }
#endif
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)
{
SDL_RWops* rw = NULL;
NSAutoreleasePool* autorelease_pool = [[NSAutoreleasePool alloc] init];
NSFileManager* file_manager = [NSFileManager defaultManager];
NSString* ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)];
NSString* full_path_with_file_to_try = [NSTemporaryDirectory() stringByAppendingPathComponent:ns_string_file_component];
rw = SDL_RWFromFile( [full_path_with_file_to_try fileSystemRepresentation], mode );
[autorelease_pool drain];
return rw;
}
/* 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);
}
#ifdef __APPLE__
#include <stdio.h>
#ifndef SDL_rwopsbundlesupport_h
#define SDL_rwopsbundlesupport_h
FILE* Test_OpenFPFromBundleOrFallback(const char *file, const char *mode);
FILE* Test_OpenFPFromTemporaryDir(const char *file, const char *mode);
#endif
#endif
...@@ -9,17 +9,11 @@ ...@@ -9,17 +9,11 @@
#include "SDL.h" #include "SDL.h"
#include "../SDL_at.h" #include "../SDL_at.h"
#if __APPLE__ #include "TestSupportRWops.h"
#include "Test_rwopsbundlesupport.h"
#endif
#define RWOPS_READ "rwops/read" /* Defined in TestSupportRWops implementation to allow flexibility. */
extern const char* RWOPS_READ;
#if __APPLE__ extern const char* RWOPS_WRITE;
#define RWOPS_WRITE "write"
#else
#define RWOPS_WRITE "rwops/write"
#endif
static const char hello_world[] = "Hello World!"; static const char hello_world[] = "Hello World!";
...@@ -193,16 +187,16 @@ static void rwops_testFile (void) ...@@ -193,16 +187,16 @@ static void rwops_testFile (void)
SDL_ATbegin( "SDL_RWFromFile" ); SDL_ATbegin( "SDL_RWFromFile" );
/* Read test. */ /* Read test. */
rw = SDL_RWFromFile( RWOPS_READ, "r" ); rw = TestSupportRWops_OpenRWopsFromReadDir( RWOPS_READ, "r" );
if (SDL_ATassert( "Opening memory with SDL_RWFromFile '"RWOPS_READ"'", rw != NULL )) if (SDL_ATassert( "Opening memory with SDL_RWFromFile RWOPS_READ", rw != NULL ))
return; return;
if (rwops_testGeneric( rw, 0 )) if (rwops_testGeneric( rw, 0 ))
return; return;
SDL_FreeRW( rw ); SDL_FreeRW( rw );
/* Write test. */ /* Write test. */
rw = SDL_RWFromFile( RWOPS_WRITE, "w+" ); rw = TestSupportRWops_OpenRWopsFromWriteDir( RWOPS_WRITE, "w+" );
if (SDL_ATassert( "Opening memory with SDL_RWFromFile '"RWOPS_WRITE"'", rw != NULL )) if (SDL_ATassert( "Opening memory with SDL_RWFromFile RWOPS_WRITE", rw != NULL ))
return; return;
if (rwops_testGeneric( rw, 1 )) if (rwops_testGeneric( rw, 1 ))
return; return;
...@@ -226,12 +220,8 @@ static void rwops_testFP (void) ...@@ -226,12 +220,8 @@ static void rwops_testFP (void)
SDL_ATbegin( "SDL_RWFromFP" ); SDL_ATbegin( "SDL_RWFromFP" );
/* Run read tests. */ /* Run read tests. */
#if __APPLE__ fp = TestSupportRWops_OpenFPFromReadDir( RWOPS_READ, "r" );
fp = Test_OpenFPFromBundleOrFallback( RWOPS_READ, "r" ); if (SDL_ATassert( "Failed to open file 'WOPS_READ", fp != NULL))
#else
fp = fopen( RWOPS_READ, "r" );
#endif
if (SDL_ATassert( "Failed to open file '"RWOPS_READ"'", fp != NULL))
return; return;
rw = SDL_RWFromFP( fp, 1 ); rw = SDL_RWFromFP( fp, 1 );
if (SDL_ATassert( "Opening memory with SDL_RWFromFP", rw != NULL )) if (SDL_ATassert( "Opening memory with SDL_RWFromFP", rw != NULL ))
...@@ -241,12 +231,8 @@ static void rwops_testFP (void) ...@@ -241,12 +231,8 @@ static void rwops_testFP (void)
SDL_FreeRW( rw ); SDL_FreeRW( rw );
/* Run write tests. */ /* Run write tests. */
#if __APPLE__ fp = TestSupportRWops_OpenFPFromWriteDir( RWOPS_WRITE, "w+" );
fp = Test_OpenFPFromTemporaryDir( RWOPS_WRITE, "w+" ); if (SDL_ATassert( "Failed to open file RWOPS_WRITE", fp != NULL))
#else
fp = fopen( RWOPS_WRITE, "w+" );
#endif
if (SDL_ATassert( "Failed to open file '"RWOPS_WRITE"'", fp != NULL))
return; return;
rw = SDL_RWFromFP( fp, 1 ); rw = SDL_RWFromFP( fp, 1 );
if (SDL_ATassert( "Opening memory with SDL_RWFromFP", rw != NULL )) if (SDL_ATassert( "Opening memory with SDL_RWFromFP", rw != NULL ))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment