Skip to content

Commit

Permalink
Getting rid of Android in SpriteBuilder Tests. Now script/./build_dis…
Browse files Browse the repository at this point in the history
…tribution.py --version 1.5.0 runs without any error
  • Loading branch information
oxeron committed Mar 5, 2016
1 parent 4308335 commit c92e695
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 184 deletions.
34 changes: 4 additions & 30 deletions SpriteBuilder/SpriteBuilder Tests/CCBPublisherController_Tests.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ - (void)setUp
self.projectSettings = [[ProjectSettings alloc] init];
_projectSettings.projectPath = [self fullPathForFile:@"baa.spritebuilder/publishtest.ccbproj"];
_projectSettings.publishDirectory = @"../Published-iOS";
_projectSettings.publishDirectoryAndroid = @"../Published-Android";

self.publisherController = [[CCBPublisherController alloc] init];
_publisherController.projectSettings = _projectSettings;
Expand Down Expand Up @@ -67,10 +66,6 @@ - (void)configureSinglePackagePublishSettingCase
iosSettings.resolution_tablethd = YES;
iosSettings.resolution_phone = YES;

PublishOSSettings *androidSettings = [_packageSettings settingsForOsType:kCCBPublisherOSTypeAndroid];
androidSettings.resolution_tablet = YES;
androidSettings.resolution_phonehd = YES;

[self createFolders:@[@"baa.spritebuilder/Packages/foo.sbpack"]];

_publisherController.packageSettings = @[_packageSettings];
Expand All @@ -86,14 +81,10 @@ - (void)testPackageExportToDefaultDirectory

[self assertFileDoesNotExist:@"Published-Packages/foo-iOS-tablethd"];
[self assertFileDoesNotExist:@"Published-Packages/foo-iOS-phone"];
[self assertFileDoesNotExist:@"Published-Packages/foo-Android-tablet"];
[self assertFileDoesNotExist:@"Published-Packages/foo-Android-phonehd"];

[self assertFilesExistRelativeToDirectory:[@"baa.spritebuilder" stringByAppendingPathComponent:DEFAULT_OUTPUTDIR_PUBLISHED_PACKAGES] filesPaths:@[
@"foo-iOS-tablethd.zip",
@"foo-iOS-phone.zip",
@"foo-Android-tablet.zip",
@"foo-Android-phonehd.zip"
@"foo-iOS-phone.zip"
]];
}

Expand All @@ -102,7 +93,6 @@ - (void)testMainProjectPublishWithOldResourcePath
[self configureSinglePackagePublishSettingCase];

_projectSettings.publishEnabledIOS = NO;
_projectSettings.publishEnabledAndroid = YES;

_packageSettings.publishToZip = NO;
_packageSettings.publishToMainProject = YES;
Expand All @@ -118,17 +108,6 @@ - (void)testMainProjectPublishWithOldResourcePath


[_publisherController startAsync:NO];

[self assertFilesExistRelativeToDirectory:@"Published-Android" filesPaths:@[
@"resources-phone/sun.png",
@"resources-phonehd/sun.png",
@"resources-tablet/sun.png",
@"resources-tablethd/sun.png",
@"resources-phone/plane.png",
@"resources-phonehd/plane.png",
@"resources-tablet/plane.png",
@"resources-tablethd/plane.png"
]];
}

- (void)testPackageExportToCustomDirectory
Expand All @@ -143,15 +122,12 @@ - (void)testPackageExportToCustomDirectory
PublishOSSettings *iosSettings = [_packageSettings settingsForOsType:kCCBPublisherOSTypeIOS];
iosSettings.resolutions = @[];

PublishOSSettings *androidSettings = [_packageSettings settingsForOsType:kCCBPublisherOSTypeAndroid];
androidSettings.resolutions = @[];
androidSettings.resolution_phone = YES;

[_publisherController startAsync:NO];

/*
[self assertFilesExistRelativeToDirectory:@"custom" filesPaths:@[
@"foo-Android-phone.zip"
]];
*/
}

- (void)testPublishMainProjectWithSomePackagesNotIncluded
Expand All @@ -164,7 +140,6 @@ - (void)testPublishMainProjectWithSomePackagesNotIncluded
[_projectSettings addResourcePath:[self fullPathForFile:@"baa.spritebuilder/Packages/Characters.sbpack"] error:nil];
[_projectSettings addResourcePath:[self fullPathForFile:@"baa.spritebuilder/Packages/Backgrounds.sbpack"] error:nil];
_projectSettings.publishEnabledIOS = YES;
_projectSettings.publishEnabledAndroid = YES;

SBPackageSettings *packageSettingsMenus = [self createSettingsWithPath:@"baa.spritebuilder/Packages/Menus.sbpack"];
packageSettingsMenus.publishToMainProject = NO;
Expand All @@ -183,7 +158,7 @@ - (void)testPublishMainProjectWithSomePackagesNotIncluded
[_publisherController startAsync:NO];

NSArray *resolutions = @[RESOLUTION_TABLET, RESOLUTION_TABLET_HD, RESOLUTION_PHONE, RESOLUTION_PHONE_HD];
NSArray *osSuffixes = @[@"iOS", @"Android"];
NSArray *osSuffixes = @[@"iOS"];

for (NSString *osSuffix in osSuffixes)
{
Expand Down Expand Up @@ -229,7 +204,6 @@ - (void)testNothingToPublish
[_publisherController startAsync:NO];

[self assertFileDoesNotExist:@"Published-iOS"];
[self assertFileDoesNotExist:@"Published-Android"];
[self assertFileDoesNotExist:DEFAULT_OUTPUTDIR_PUBLISHED_PACKAGES];
}

Expand Down
43 changes: 2 additions & 41 deletions SpriteBuilder/SpriteBuilder Tests/CCBPublisher_Tests.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ @interface CCBPublisher_Tests : FileSystemTestCase
@property (nonatomic, strong) CCBWarnings *warnings;
@property (nonatomic, strong) CCBPublisher *publisher;
@property (nonatomic, strong) CCBPublishingTarget *targetIOS;
@property (nonatomic, strong) CCBPublishingTarget *targetAndroid;

@end

Expand All @@ -44,7 +43,6 @@ - (void)setUp
self.projectSettings = [[ProjectSettings alloc] init];
_projectSettings.projectPath = [self fullPathForFile:@"baa.spritebuilder/publishtest.ccbproj"];
_projectSettings.publishEnabledIOS = YES;
_projectSettings.publishEnabledAndroid = NO;

RMPackage *package = [[RMPackage alloc] init];
package.dirPath = [self fullPathForFile:@"baa.spritebuilder/Packages/foo.sbpack"];
Expand All @@ -64,13 +62,7 @@ - (void)setUp
_targetIOS.outputDirectory = [self fullPathForFile:@"Published-iOS"];
_targetIOS.resolutions = [_projectSettings publishingResolutionsForOSType:kCCBPublisherOSTypeIOS];

self.targetAndroid = [[CCBPublishingTarget alloc] init];
_targetAndroid.osType = kCCBPublisherOSTypeAndroid;
_targetAndroid.inputDirectories = @[[self fullPathForFile:@"baa.spritebuilder/Packages/foo.sbpack"]];
_targetAndroid.outputDirectory = [self fullPathForFile:@"Published-Android"];
_targetAndroid.resolutions = [_projectSettings publishingResolutionsForOSType:kCCBPublisherOSTypeAndroid];

[self createFolders:@[@"Published-iOS", @"Published-Android", @"baa.spritebuilder/Packages/foo.sbpack"]];
[self createFolders:@[@"Published-iOS", @"baa.spritebuilder/Packages/foo.sbpack"]];
}

- (void)testPublishingProject
Expand Down Expand Up @@ -148,27 +140,14 @@ - (void)testPublishingOfResolutions
_projectSettings.publishResolution_ios_phone = NO;
_projectSettings.publishResolution_ios_phonehd = YES;

_projectSettings.publishEnabledAndroid = YES;
_projectSettings.publishResolution_android_tablet = NO;
_projectSettings.publishResolution_android_tablethd = YES;
_projectSettings.publishResolution_android_phone = YES;
_projectSettings.publishResolution_android_phonehd = NO;

_targetIOS.resolutions = [_projectSettings publishingResolutionsForOSType:kCCBPublisherOSTypeIOS];
[_publisher addPublishingTarget:_targetIOS];
_targetAndroid.resolutions = [_projectSettings publishingResolutionsForOSType:kCCBPublisherOSTypeAndroid];
[_publisher addPublishingTarget:_targetAndroid];
[_publisher start];

[self assertFileExists:@"Published-iOS/resources-phonehd/picture.png"];
[self assertFileExists:@"Published-iOS/resources-tablet/picture.png"];
[self assertFileDoesNotExist:@"Published-iOS/resources-phone/picture.png"];
[self assertFileDoesNotExist:@"Published-iOS/resources-tablethd/picture.png"];

[self assertFileExists:@"Published-Android/resources-phone/picture.png"];
[self assertFileExists:@"Published-Android/resources-tablethd/picture.png"];
[self assertFileDoesNotExist:@"Published-Android/resources-phonehd/picture.png"];
[self assertFileDoesNotExist:@"Published-Android/resources-tablet/picture.png"];
}

- (void)testPublishBMFont
Expand Down Expand Up @@ -241,49 +220,34 @@ - (void)testCustomScalingFactorsForImages
[self assertPNGAtPath:@"Published-iOS/resources-phonehd/rocket.png" hasWidth:8 hasHeight:40];
}

- (void)testDifferentOutputFormatsForIOSAndAndroid
- (void)testDifferentOutputFormatsForIOS
{
[self createPNGAtPath:@"baa.spritebuilder/Packages/foo.sbpack/resources-auto/rocket.png" width:4 height:20];
[self copyTestingResource:@"blank.wav" toFolder:@"baa.spritebuilder/Packages/foo.sbpack"];

_projectSettings.publishEnabledAndroid = YES;
_projectSettings.resourceAutoScaleFactor = 4;

[_projectSettings setProperty:@(kFCImageFormatJPG_High) forRelPath:@"rocket.png" andKey:RESOURCE_PROPERTY_IOS_IMAGE_FORMAT];
[_projectSettings setProperty:@(kFCImageFormatJPG_High) forRelPath:@"rocket.png" andKey:RESOURCE_PROPERTY_ANDROID_IMAGE_FORMAT];
[_projectSettings setProperty:@(kFCSoundFormatMP4) forRelPath:@"blank.wav" andKey:RESOURCE_PROPERTY_IOS_SOUND];

[_publisher addPublishingTarget:_targetIOS];
[_publisher addPublishingTarget:_targetAndroid];
[_publisher start];

[self assertRenamingRuleInfFileLookup:@"Published-iOS/fileLookup.plist" originalName:@"rocket.png" renamedName:@"rocket.jpg"];
[self assertRenamingRuleInfFileLookup:@"Published-iOS/fileLookup.plist" originalName:@"blank.wav" renamedName:@"blank.m4a"];

[self assertRenamingRuleInfFileLookup:@"Published-Android/fileLookup.plist" originalName:@"rocket.png" renamedName:@"rocket.jpg"];
[self assertRenamingRuleInfFileLookup:@"Published-Android/fileLookup.plist" originalName:@"blank.wav" renamedName:@"blank.ogg"];

[self assertJPGAtPath:@"Published-iOS/resources-tablet/rocket.jpg" hasWidth:2 hasHeight:10];
[self assertJPGAtPath:@"Published-iOS/resources-tablethd/rocket.jpg" hasWidth:4 hasHeight:20];
[self assertJPGAtPath:@"Published-iOS/resources-phone/rocket.jpg" hasWidth:1 hasHeight:5];
[self assertJPGAtPath:@"Published-iOS/resources-phonehd/rocket.jpg" hasWidth:2 hasHeight:10];

[self assertJPGAtPath:@"Published-Android/resources-tablet/rocket.jpg" hasWidth:2 hasHeight:10];
[self assertJPGAtPath:@"Published-Android/resources-tablethd/rocket.jpg" hasWidth:4 hasHeight:20];
[self assertJPGAtPath:@"Published-Android/resources-phone/rocket.jpg" hasWidth:1 hasHeight:5];
[self assertJPGAtPath:@"Published-Android/resources-phonehd/rocket.jpg" hasWidth:2 hasHeight:10];

[self assertFileExists:@"Published-iOS/blank.m4a"];
[self assertFileExists:@"Published-Android/blank.ogg"];

NSData *wavData = [[NSFileManager defaultManager] contentsAtPath:[self fullPathForFile:@"baa.spritebuilder/Packages/foo.sbpack/blank.wav"]];
NSData *m4aData = [[NSFileManager defaultManager] contentsAtPath:[self fullPathForFile:@"Published-iOS/blank.m4a"]];
NSData *oggData = [[NSFileManager defaultManager] contentsAtPath:[self fullPathForFile:@"Published-Android/blank.ogg"]];
XCTAssertNotNil(wavData, @"wav data must not be nil");
XCTAssertNotNil(m4aData, @"m4a data must not be nil");
XCTAssertNotNil(oggData, @"ogg data must not be nil");
XCTAssertTrue(![m4aData isEqualToData:wavData], @"m4a data must be different than wav data");
XCTAssertTrue(![oggData isEqualToData:wavData], @"ogg data must be different than wav data");
}

- (void)testSpriteSheets
Expand Down Expand Up @@ -439,15 +403,12 @@ - (void)testEnums
{
XCTAssertEqual(kCCBPublisherOSTypeHTML5, 0, @"Enum value kCCBPublisherOSTypeHTML5 must not change");
XCTAssertEqual(kCCBPublisherOSTypeIOS, 1, @"Enum value kCCBPublisherOSTypeIOS must not change");
XCTAssertEqual(kCCBPublisherOSTypeAndroid, 2, @"Enum value kCCBPublisherOSTypeAndroid must not change");

XCTAssertEqual(kCCBPublishEnvironmentDevelop, 0, @"Enum value kCCBPublishEnvironmentDevelop must not change");
XCTAssertEqual(kCCBPublishEnvironmentRelease, 1, @"Enum value kCCBPublishEnvironmentRelease must not change");

XCTAssertEqual(kCCBPublishFormatSound_ios_caf, 0, @"Enum value kCCBPublishFormatSound_ios_caf must not change");
XCTAssertEqual(kCCBPublishFormatSound_ios_mp4, 1, @"Enum value kCCBPublishFormatSound_ios_mp4 must not change");

XCTAssertEqual(kCCBPublishFormatSound_android_ogg, 0, @"Enum value kCCBPublishFormatSound_android_ogg must not change");
}

#pragma mark - assert helpers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,6 @@ - (void)testSupportsCompress
XCTAssertFalse([ImageFormatAndPropertiesHelper supportsCompress:kFCImageFormatJPG_High osType:kCCBPublisherOSTypeIOS]);
XCTAssertFalse([ImageFormatAndPropertiesHelper supportsCompress:kFCImageFormatJPG_Medium osType:kCCBPublisherOSTypeIOS]);
XCTAssertFalse([ImageFormatAndPropertiesHelper supportsCompress:kFCImageFormatJPG_Low osType:kCCBPublisherOSTypeIOS]);

// Android
XCTAssertFalse([ImageFormatAndPropertiesHelper supportsCompress:kFCImageFormatPVR_RGBA8888 osType:kCCBPublisherOSTypeAndroid]);
XCTAssertFalse([ImageFormatAndPropertiesHelper supportsCompress:kFCImageFormatPVR_RGBA4444 osType:kCCBPublisherOSTypeAndroid]);
XCTAssertFalse([ImageFormatAndPropertiesHelper supportsCompress:kFCImageFormatPVR_RGB565 osType:kCCBPublisherOSTypeAndroid]);
XCTAssertFalse([ImageFormatAndPropertiesHelper supportsCompress:kFCImageFormatPVRTC_2BPP osType:kCCBPublisherOSTypeAndroid]);
XCTAssertFalse([ImageFormatAndPropertiesHelper supportsCompress:kFCImageFormatPVRTC_4BPP osType:kCCBPublisherOSTypeAndroid]);
XCTAssertFalse([ImageFormatAndPropertiesHelper supportsCompress:kFCImageFormatPNG osType:kCCBPublisherOSTypeAndroid]);
XCTAssertFalse([ImageFormatAndPropertiesHelper supportsCompress:kFCImageFormatPNG_8BIT osType:kCCBPublisherOSTypeAndroid]);
XCTAssertFalse([ImageFormatAndPropertiesHelper supportsCompress:kFCImageFormatJPG_High osType:kCCBPublisherOSTypeAndroid]);
XCTAssertFalse([ImageFormatAndPropertiesHelper supportsCompress:kFCImageFormatJPG_Medium osType:kCCBPublisherOSTypeAndroid]);
XCTAssertFalse([ImageFormatAndPropertiesHelper supportsCompress:kFCImageFormatJPG_Low osType:kCCBPublisherOSTypeAndroid]);
}

- (void)testSupportsDither
Expand All @@ -67,20 +55,6 @@ - (void)testSupportsDither
XCTAssertFalse([ImageFormatAndPropertiesHelper supportsDither:kFCImageFormatJPG_High osType:kCCBPublisherOSTypeIOS]);
XCTAssertFalse([ImageFormatAndPropertiesHelper supportsDither:kFCImageFormatJPG_Medium osType:kCCBPublisherOSTypeIOS]);
XCTAssertFalse([ImageFormatAndPropertiesHelper supportsDither:kFCImageFormatJPG_Low osType:kCCBPublisherOSTypeIOS]);

// Android
XCTAssertTrue([ImageFormatAndPropertiesHelper supportsDither:kFCImageFormatPNG_8BIT osType:kCCBPublisherOSTypeAndroid]);
XCTAssertTrue([ImageFormatAndPropertiesHelper supportsDither:kFCImageFormatPVR_RGBA4444 osType:kCCBPublisherOSTypeAndroid]);
XCTAssertTrue([ImageFormatAndPropertiesHelper supportsDither:kFCImageFormatPVR_RGB565 osType:kCCBPublisherOSTypeAndroid]);

XCTAssertFalse([ImageFormatAndPropertiesHelper supportsDither:kFCImageFormatPVR_RGBA8888 osType:kCCBPublisherOSTypeAndroid]);
XCTAssertFalse([ImageFormatAndPropertiesHelper supportsDither:kFCImageFormatPVRTC_2BPP osType:kCCBPublisherOSTypeAndroid]);
XCTAssertFalse([ImageFormatAndPropertiesHelper supportsDither:kFCImageFormatPVRTC_4BPP osType:kCCBPublisherOSTypeAndroid]);
XCTAssertFalse([ImageFormatAndPropertiesHelper supportsDither:kFCImageFormatPVR_RGBA8888 osType:kCCBPublisherOSTypeAndroid]);
XCTAssertFalse([ImageFormatAndPropertiesHelper supportsDither:kFCImageFormatPNG osType:kCCBPublisherOSTypeAndroid]);
XCTAssertFalse([ImageFormatAndPropertiesHelper supportsDither:kFCImageFormatJPG_High osType:kCCBPublisherOSTypeAndroid]);
XCTAssertFalse([ImageFormatAndPropertiesHelper supportsDither:kFCImageFormatJPG_Medium osType:kCCBPublisherOSTypeAndroid]);
XCTAssertFalse([ImageFormatAndPropertiesHelper supportsDither:kFCImageFormatJPG_Low osType:kCCBPublisherOSTypeAndroid]);
}

@end
Loading

0 comments on commit c92e695

Please sign in to comment.