Skip to content

Commit 323db86

Browse files
committed
Fixed CCSpriteFrameCacheTests.
Some weirdnesses with the copy bundle phase.
1 parent d0db9a2 commit 323db86

File tree

11 files changed

+14
-6
lines changed

11 files changed

+14
-6
lines changed

UnitTests/CCSpriteFrameCacheTests.m

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,27 +58,35 @@ - (void)tearDown
5858
- (void)testLoadSpriteFrameLookupsInAllSearchPathsWithName
5959
{
6060
NSString *pathToUnzippedPackage = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"Resources-shared/Packages/testpackage-iOS-phonehd_unzipped/testpackage-iOS-phonehd"];
61-
NSString *pathToUnzippedPackage2 = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"Resources-shared/Packages/testpackage-iOS-phonehd_unzipped/testpackage-iOS-phonehd"];
61+
NSString *pathToUnzippedPackage2 = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"Resources-shared/Packages/anotherpackage-iOS-phonehd_unzipped/anotherpackage-iOS-phonehd"];
6262

6363
NSString *newSearchPathForPackage = [NSTemporaryDirectory() stringByAppendingPathComponent:@"testpackage-iOS-phonehd"];
64-
NSString *newSearchPathForPackage2 = [NSTemporaryDirectory() stringByAppendingPathComponent:@"testpackage2-iOS-phonehd"];
64+
NSString *newSearchPathForPackage2 = [NSTemporaryDirectory() stringByAppendingPathComponent:@"anotherpackage-iOS-phonehd"];
6565

6666
NSFileManager *fileManager = [NSFileManager defaultManager];
6767
[fileManager removeItemAtPath:newSearchPathForPackage error:nil];
68-
[fileManager copyItemAtPath:pathToUnzippedPackage toPath:newSearchPathForPackage error:nil];
68+
NSError *error1;
69+
if (![fileManager copyItemAtPath:pathToUnzippedPackage toPath:newSearchPathForPackage error:&error1])
70+
{
71+
NSLog(@"1: %@", error1);
72+
}
6973

7074
[fileManager removeItemAtPath:newSearchPathForPackage2 error:nil];
71-
[fileManager copyItemAtPath:pathToUnzippedPackage2 toPath:newSearchPathForPackage2 error:nil];
75+
NSError *error2;
76+
if (![fileManager copyItemAtPath:pathToUnzippedPackage2 toPath:newSearchPathForPackage2 error:&error2])
77+
{
78+
NSLog(@"2: %@", error2);
79+
}
7280

7381
[CCFileUtils sharedFileUtils].searchPath = @[newSearchPathForPackage,newSearchPathForPackage2];
7482

7583
[[CCSpriteFrameCache sharedSpriteFrameCache] loadSpriteFrameLookupsInAllSearchPathsWithName:@"spriteFrameFileList.plist"];
7684

7785
CCSpriteFrame *frame1 = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:@"smileys/angrySmiley.png"];
78-
CCSpriteFrame *frame2 = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:@"moresmileys/confusedSmiley.png"];
86+
CCSpriteFrame *frame2 = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:@"moresmileys/knockOutSmiley.png"];
7987

8088
XCTAssertNotNil(frame1, @"Error loading: smileys/angrySmiley.png");
81-
XCTAssertNotNil(frame2, @"Error loading: smileys/moresmileys/confusedSmiley.png");
89+
XCTAssertNotNil(frame2, @"Error loading: moresmileys/confusedSmiley.png");
8290
}
8391

8492
@end
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)