diff options
Diffstat (limited to 'UnitTesting')
-rw-r--r-- | UnitTesting/GTMIPhoneUnitTestMain.m | 10 | ||||
-rw-r--r-- | UnitTesting/GTMNSObject+UnitTesting.m | 12 | ||||
-rw-r--r-- | UnitTesting/GTMSenTestCase.h | 9 | ||||
-rw-r--r-- | UnitTesting/GTMSenTestCase.m | 4 | ||||
-rw-r--r-- | UnitTesting/GTMUIKit+UnitTestingTest.m | 10 |
5 files changed, 25 insertions, 20 deletions
diff --git a/UnitTesting/GTMIPhoneUnitTestMain.m b/UnitTesting/GTMIPhoneUnitTestMain.m index 2a0a70d..b7af4ba 100644 --- a/UnitTesting/GTMIPhoneUnitTestMain.m +++ b/UnitTesting/GTMIPhoneUnitTestMain.m @@ -6,9 +6,9 @@ // Licensed under the Apache License, Version 2.0 (the "License"); you may not // use this file except in compliance with the License. You may obtain a copy // of the License at -// +// // http://www.apache.org/licenses/LICENSE-2.0 -// +// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the @@ -27,7 +27,13 @@ // afterwards. int main(int argc, char *argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; +#if GTM_IPHONE_USE_SENTEST + // Is using SenTest, just create a dummy app that can be used as the + // TEST_HOST. + int retVal = UIApplicationMain(argc, argv, nil, nil); +#else int retVal = UIApplicationMain(argc, argv, nil, @"GTMIPhoneUnitTestDelegate"); +#endif [pool release]; return retVal; } diff --git a/UnitTesting/GTMNSObject+UnitTesting.m b/UnitTesting/GTMNSObject+UnitTesting.m index 3796839..5e628d3 100644 --- a/UnitTesting/GTMNSObject+UnitTesting.m +++ b/UnitTesting/GTMNSObject+UnitTesting.m @@ -428,13 +428,11 @@ static NSString *gGTMUnitTestSaveToDirectory = nil; @synchronized([self class]) { if (!gGTMUnitTestSaveToDirectory) { #if GTM_IPHONE_SDK - // Developer build, use their home directory Desktop. - gGTMUnitTestSaveToDirectory - = [[[[[NSHomeDirectory() stringByDeletingLastPathComponent] - stringByDeletingLastPathComponent] - stringByDeletingLastPathComponent] - stringByDeletingLastPathComponent] - stringByAppendingPathComponent:@"Desktop"]; + // About the only thing safe for the sandbox is the documents directory. + NSArray *documentsDirs + = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, + NSUserDomainMask, YES); + gGTMUnitTestSaveToDirectory = [documentsDirs objectAtIndex:0]; #else NSArray *desktopDirs = NSSearchPathForDirectoriesInDomains(NSDesktopDirectory, diff --git a/UnitTesting/GTMSenTestCase.h b/UnitTesting/GTMSenTestCase.h index 5f7b03c..08ad162 100644 --- a/UnitTesting/GTMSenTestCase.h +++ b/UnitTesting/GTMSenTestCase.h @@ -53,7 +53,7 @@ #import "GTMDefines.h" -#if (!GTM_IPHONE_SDK) +#if (!GTM_IPHONE_SDK) || (GTM_IPHONE_USE_SENTEST) #import <SenTestingKit/SenTestingKit.h> #else #import <Foundation/Foundation.h> @@ -65,7 +65,7 @@ NSString *STComposeString(NSString *, ...); } #endif -#endif // !GTM_IPHONE_SDK +#endif // !GTM_IPHONE_SDK || GTM_IPHONE_USE_SENTEST // Generates a failure when a1 != noErr // Args: @@ -461,7 +461,8 @@ do { \ } \ } while(0) -#if GTM_IPHONE_SDK +#if GTM_IPHONE_SDK && !GTM_IPHONE_USE_SENTEST +// When not using the Xcode provided version, define everything ourselves. // SENTE_BEGIN /*" Generates a failure when !{ [a1 isEqualTo:a2] } is false @@ -1002,7 +1003,7 @@ GTM_EXTERN NSString *const SenTestFailureException; GTM_EXTERN NSString *const SenTestFilenameKey; GTM_EXTERN NSString *const SenTestLineNumberKey; -#endif // GTM_IPHONE_SDK +#endif // GTM_IPHONE_SDK && !GTM_IPHONE_USE_SENTEST // All unittest cases in GTM should inherit from GTMTestCase. It makes sure // to set up our logging system correctly to verify logging calls. diff --git a/UnitTesting/GTMSenTestCase.m b/UnitTesting/GTMSenTestCase.m index 2b0a8f7..9a0b941 100644 --- a/UnitTesting/GTMSenTestCase.m +++ b/UnitTesting/GTMSenTestCase.m @@ -30,7 +30,7 @@ #import "GTMGarbageCollection.h" #endif // !GTM_IPHONE_SDK -#if GTM_IPHONE_SDK +#if GTM_IPHONE_SDK && !GTM_IPHONE_USE_SENTEST #import <stdarg.h> @interface NSException (GTMSenTestPrivateAdditions) @@ -397,7 +397,7 @@ static int MethodSort(id a, id b, void *context) { @end -#endif // GTM_IPHONE_SDK +#endif // GTM_IPHONE_SDK && !GTM_IPHONE_USE_SENTEST @implementation GTMTestCase : SenTestCase - (void)invokeTest { diff --git a/UnitTesting/GTMUIKit+UnitTestingTest.m b/UnitTesting/GTMUIKit+UnitTestingTest.m index 8b3effa..95bdd5a 100644 --- a/UnitTesting/GTMUIKit+UnitTestingTest.m +++ b/UnitTesting/GTMUIKit+UnitTestingTest.m @@ -6,9 +6,9 @@ // Licensed under the Apache License, Version 2.0 (the "License"); you may not // use this file except in compliance with the License. You may obtain a copy // of the License at -// +// // http://www.apache.org/licenses/LICENSE-2.0 -// +// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the @@ -20,14 +20,14 @@ #import "GTMUIKit+UnitTesting.h" #import "GTMSenTestCase.h" -@interface GTMUIView_UnitTestingTest : SenTestCase <GTMUnitTestViewDrawer> +@interface GTMUIView_UnitTestingTest : GTMTestCase <GTMUnitTestViewDrawer> @end @implementation GTMUIView_UnitTestingTest - (void)testDrawing { - GTMAssertDrawingEqualToFile(self, - CGSizeMake(200,200), + GTMAssertDrawingEqualToFile(self, + CGSizeMake(200,200), @"GTMUIViewUnitTestingTest", [UIApplication sharedApplication], nil); |