Ben Copsey

Move tests to GHUnit

@@ -8,7 +8,6 @@ @@ -8,7 +8,6 @@
8 8
9 #import <SenTestingKit/SenTestingKit.h> 9 #import <SenTestingKit/SenTestingKit.h>
10 10
11 -  
12 @interface ASIFormDataRequestTests : SenTestCase { 11 @interface ASIFormDataRequestTests : SenTestCase {
13 float progress; 12 float progress;
14 } 13 }
@@ -139,7 +139,12 @@ @@ -139,7 +139,12 @@
139 //BOOL success = (![[NSFileManager defaultManager] fileExistsAtPath:tempPath]); 139 //BOOL success = (![[NSFileManager defaultManager] fileExistsAtPath:tempPath]);
140 //STAssertTrue(success,@"Failed to remove file from temporary location"); 140 //STAssertTrue(success,@"Failed to remove file from temporary location");
141 141
  142 +#if TARGET_OS_IPHONE
  143 + UIImage *image = [[[UIImage alloc] initWithContentsOfFile:path] autorelease];
  144 +#else
142 NSImage *image = [[[NSImage alloc] initWithContentsOfFile:path] autorelease]; 145 NSImage *image = [[[NSImage alloc] initWithContentsOfFile:path] autorelease];
  146 +#endif
  147 +
143 STAssertNotNil(image,@"Failed to download data to a file"); 148 STAssertNotNil(image,@"Failed to download data to a file");
144 } 149 }
145 150
@@ -12,6 +12,8 @@ @@ -12,6 +12,8 @@
12 12
13 @implementation ASINetworkQueueTests 13 @implementation ASINetworkQueueTests
14 14
  15 +static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMode");
  16 +
15 - (void)testProgress 17 - (void)testProgress
16 { 18 {
17 complete = NO; 19 complete = NO;
@@ -38,9 +40,8 @@ @@ -38,9 +40,8 @@
38 40
39 [networkQueue go]; 41 [networkQueue go];
40 42
41 - NSDate* endDate = [NSDate distantFuture];  
42 while (!complete) { 43 while (!complete) {
43 - [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:endDate]; 44 + CFRunLoopRunInMode(ASIHTTPRequestTestsRunMode,0.25,YES);
44 } 45 }
45 46
46 BOOL success = (progress == 1.0); 47 BOOL success = (progress == 1.0);
@@ -66,7 +67,8 @@ @@ -66,7 +67,8 @@
66 67
67 [networkQueue waitUntilAllOperationsAreFinished]; 68 [networkQueue waitUntilAllOperationsAreFinished];
68 69
69 - success = (progress == 1.0); 70 + // Progress maths are inexact for queues
  71 + success = (progress > 0.95);
70 STAssertTrue(success,@"Failed to increment progress properly"); 72 STAssertTrue(success,@"Failed to increment progress properly");
71 73
72 74
@@ -209,6 +211,7 @@ @@ -209,6 +211,7 @@
209 complete = YES; 211 complete = YES;
210 } 212 }
211 213
  214 +
212 - (void)testProgressWithAuthentication 215 - (void)testProgressWithAuthentication
213 { 216 {
214 complete = NO; 217 complete = NO;
@@ -228,9 +231,9 @@ @@ -228,9 +231,9 @@
228 231
229 [networkQueue go]; 232 [networkQueue go];
230 233
231 - NSDate* endDate = [NSDate distantFuture]; 234 +
232 while (!complete) { 235 while (!complete) {
233 - [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:endDate]; 236 + CFRunLoopRunInMode(ASIHTTPRequestTestsRunMode,0.25,YES);
234 } 237 }
235 238
236 NSError *error = [request error]; 239 NSError *error = [request error];
@@ -252,19 +255,14 @@ @@ -252,19 +255,14 @@
252 [networkQueue go]; 255 [networkQueue go];
253 256
254 while (!complete) { 257 while (!complete) {
255 - [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:endDate]; 258 + CFRunLoopRunInMode(ASIHTTPRequestTestsRunMode,0.25,YES);
256 } 259 }
257 260
258 error = [request error]; 261 error = [request error];
259 STAssertNil(error,@"Failed to use authentication in a queue"); 262 STAssertNil(error,@"Failed to use authentication in a queue");
260 [networkQueue release]; 263 [networkQueue release];
261 264
262 -  
263 -  
264 -  
265 -  
266 } 265 }
267 266
268 267
269 -  
270 @end 268 @end
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3 +<plist version="1.0">
  4 +<dict>
  5 + <key>CFBundleDevelopmentRegion</key>
  6 + <string>English</string>
  7 + <key>CFBundleExecutable</key>
  8 + <string>${EXECUTABLE_NAME}</string>
  9 + <key>CFBundleIdentifier</key>
  10 + <string>com.yourcompany.${PRODUCT_NAME:identifier}</string>
  11 + <key>CFBundleInfoDictionaryVersion</key>
  12 + <string>6.0</string>
  13 + <key>CFBundlePackageType</key>
  14 + <string>APPL</string>
  15 + <key>CFBundleSignature</key>
  16 + <string>????</string>
  17 + <key>CFBundleVersion</key>
  18 + <string>1.0</string>
  19 + <key>NSMainNibFile</key>
  20 + <string>MainMenu</string>
  21 + <key>NSPrincipalClass</key>
  22 + <string>NSApplication</string>
  23 +</dict>
  24 +</plist>
This diff was suppressed by a .gitattributes entry.
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3 +<plist version="1.0">
  4 +<dict>
  5 + <key>CFBundleDevelopmentRegion</key>
  6 + <string>English</string>
  7 + <key>CFBundleExecutable</key>
  8 + <string>${EXECUTABLE_NAME}</string>
  9 + <key>CFBundleIdentifier</key>
  10 + <string>com.yourcompany.${PRODUCT_NAME:identifier}</string>
  11 + <key>CFBundleInfoDictionaryVersion</key>
  12 + <string>6.0</string>
  13 + <key>CFBundlePackageType</key>
  14 + <string>APPL</string>
  15 + <key>CFBundleSignature</key>
  16 + <string>????</string>
  17 + <key>CFBundleVersion</key>
  18 + <string>1.0</string>
  19 + <key>NSMainNibFile</key>
  20 + <string>GHUnitIPhone.xib</string>
  21 +</dict>
  22 +</plist>