forked from cocos2d/cocos2d-objc
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathCCPackageHelperTests.m
48 lines (37 loc) · 1.75 KB
/
CCPackageHelperTests.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
// CCPackageHelperTests.m
// cocos2d-tests-ios
//
// Created by Nicky Weber on 29.09.14.
// Copyright (c) 2014 Cocos2d. All rights reserved.
//
#import <XCTest/XCTest.h>
#import "CCFileLocator.h"
#import "CCPackageHelper.h"
#import "CCUnitTestHelperMacros.h"
@interface CCPackageHelperTests : XCTestCase
@property (nonatomic, strong) NSMutableArray *searchResolutionsOrderBackup;
@end
@implementation CCPackageHelperTests
- (void)testDefaultResolution
{
// Standard test
[CCFileUtils sharedFileUtils].searchResolutionsOrder = [@[CCFileUtilsSuffixiPhoneHD, CCFileUtilsSuffixiPadHD] mutableCopy];
NSString *mappedResolution = [CCPackageHelper ccFileUtilsSuffixToResolution:CCFileUtilsSuffixiPhoneHD];
NSString *defaultResolution = [CCPackageHelper defaultResolution];
XCTAssertEqualObjects(defaultResolution, mappedResolution);
// Ignore non mappable entriy and pick next
[CCFileUtils sharedFileUtils].searchResolutionsOrder = [@[@"weird_nonsense", CCFileUtilsSuffixiPadHD] mutableCopy];
NSString *mappedResolution2 = [CCPackageHelper ccFileUtilsSuffixToResolution:CCFileUtilsSuffixiPadHD];
NSString *defaultResolution2 = [CCPackageHelper defaultResolution];
XCTAssertEqualObjects(defaultResolution2, mappedResolution2);
// Return default since nothing can be mapped
[CCFileUtils sharedFileUtils].searchResolutionsOrder = [@[@"nothing_to_be_mapped"] mutableCopy];
NSString *defaultResolution3 = [CCPackageHelper defaultResolution];
XCTAssertEqualObjects(defaultResolution3, @"phonehd");
// Empty array
[CCFileUtils sharedFileUtils].searchResolutionsOrder = [@[] mutableCopy];
NSString *defaultResolution4 = [CCPackageHelper defaultResolution];
XCTAssertEqualObjects(defaultResolution4, @"phonehd");
}
@end