You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2014/10/01 02:52:27 UTC
git commit: Added more iOS splash screen tests.
Repository: cordova-plugin-splashscreen
Updated Branches:
refs/heads/master 55722de1c -> 4d548e67c
Added more iOS splash screen tests.
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/commit/4d548e67
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/tree/4d548e67
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/diff/4d548e67
Branch: refs/heads/master
Commit: 4d548e67c2aaa2bc9b460385ad7f01985a6086b5
Parents: 55722de
Author: Shazron Abdullah <sh...@apache.org>
Authored: Tue Sep 30 17:52:51 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Tue Sep 30 17:52:51 2014 -0700
----------------------------------------------------------------------
.../CDVSplashScreenLibTests/ImageNameTest.m | 151 +++++++++++++++++++
1 file changed, 151 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/4d548e67/tests/ios/CDVSplashScreenTest/CDVSplashScreenLibTests/ImageNameTest.m
----------------------------------------------------------------------
diff --git a/tests/ios/CDVSplashScreenTest/CDVSplashScreenLibTests/ImageNameTest.m b/tests/ios/CDVSplashScreenTest/CDVSplashScreenLibTests/ImageNameTest.m
index e9fb642..b19cbc5 100644
--- a/tests/ios/CDVSplashScreenTest/CDVSplashScreenLibTests/ImageNameTest.m
+++ b/tests/ios/CDVSplashScreenTest/CDVSplashScreenLibTests/ImageNameTest.m
@@ -115,6 +115,33 @@ const CDV_iOSDevice CDV_iOSDeviceZero = { 0, 0, 0, 0, 0, 0 };
}
+- (void) currentOrientationNotSupportedHelper:(UIInterfaceOrientation)initialOrientation delegate:(id<CDVScreenOrientationDelegate>)delegate
+{
+ NSString* name = nil;
+ CDV_iOSDevice device;
+
+ // Portrait, iPad, non-iPhone5
+ device = CDV_iOSDeviceZero; device.iPad = YES; device.iPhone5 = NO;
+ name = [self.plugin getImageName:initialOrientation delegate:delegate device:device];
+ XCTAssertTrue([@"Default-Portrait" isEqualToString:name], @"Portrait - iPad failed (%@)", name);
+
+ // Portrait, non-iPad, iPhone5
+ device = CDV_iOSDeviceZero; device.iPad = NO; device.iPhone5 = YES;
+ name = [self.plugin getImageName:initialOrientation delegate:delegate device:device];
+ XCTAssertTrue([@"Default-568h" isEqualToString:name], @"Portrait - iPhone 5 failed (%@)", name);
+
+ // Portrait, non-iPad, iPhone6
+ device = CDV_iOSDeviceZero; device.iPad = NO; device.iPhone6 = YES;
+ name = [self.plugin getImageName:initialOrientation delegate:delegate device:device];
+ XCTAssertTrue([@"Default-667h" isEqualToString:name], @"Portrait - iPhone 6 failed (%@)", name);
+
+ // Portrait, non-iPad, iPhone6Plus
+ device = CDV_iOSDeviceZero; device.iPad = NO; device.iPhone6Plus = YES;
+ name = [self.plugin getImageName:initialOrientation delegate:delegate device:device];
+ XCTAssertTrue([@"Default-736h" isEqualToString:name], @"Portrait - iPhone 6Plus failed (%@)", name);
+}
+
+
- (void)testPortraitOnly {
PortraitOnly* delegate = [[PortraitOnly alloc] init];
@@ -203,4 +230,128 @@ const CDV_iOSDevice CDV_iOSDeviceZero = { 0, 0, 0, 0, 0, 0 };
[self landscapeHelper:UIInterfaceOrientationLandscapeRight delegate:delegate];
}
+- (void)testiPadCurrentOrientationNotSupported {
+
+ NSString* name = nil;
+ CDV_iOSDevice device;
+ UIInterfaceOrientation currentOrientation;
+
+ /// PORTRAIT
+
+ PortraitOnly* delegate = [[PortraitOnly alloc] init];
+
+ // LandscapeLeft, iPad - should always return Portrait
+ device = CDV_iOSDeviceZero; device.iPad = YES;
+ currentOrientation = UIInterfaceOrientationLandscapeLeft;
+ name = [self.plugin getImageName:currentOrientation delegate:delegate device:device];
+ XCTAssertTrue([@"Default-Portrait" isEqualToString:name], @"Portrait - iPad failed (%@)", name);
+
+ // LandscapeRight, iPad - should always return Portrait
+ device = CDV_iOSDeviceZero; device.iPad = YES;
+ currentOrientation = UIInterfaceOrientationLandscapeRight;
+ name = [self.plugin getImageName:currentOrientation delegate:delegate device:device];
+ XCTAssertTrue([@"Default-Portrait" isEqualToString:name], @"Portrait - iPad failed (%@)", name);
+
+ // Portrait, iPad - should always return Portrait
+ device = CDV_iOSDeviceZero; device.iPad = YES;
+ currentOrientation = UIInterfaceOrientationPortrait;
+ name = [self.plugin getImageName:currentOrientation delegate:delegate device:device];
+ XCTAssertTrue([@"Default-Portrait" isEqualToString:name], @"Portrait - iPad failed (%@)", name);
+
+ // PortraitUpsideDown, iPad - should always return Portrait
+ device = CDV_iOSDeviceZero; device.iPad = YES;
+ currentOrientation = UIInterfaceOrientationPortraitUpsideDown;
+ name = [self.plugin getImageName:currentOrientation delegate:delegate device:device];
+ XCTAssertTrue([@"Default-Portrait" isEqualToString:name], @"Portrait - iPad failed (%@)", name);
+
+ /// PORTRAIT UPSIDE DOWN
+
+ PortraitUpsideDownOnly* delegate2 = [[PortraitUpsideDownOnly alloc] init];
+
+ // LandscapeLeft, iPad - should always return Portrait
+ device = CDV_iOSDeviceZero; device.iPad = YES;
+ currentOrientation = UIInterfaceOrientationLandscapeLeft;
+ name = [self.plugin getImageName:currentOrientation delegate:delegate2 device:device];
+ XCTAssertTrue([@"Default-Portrait" isEqualToString:name], @"Portrait - iPad failed (%@)", name);
+
+ // LandscapeRight, iPad - should always return Portrait
+ device = CDV_iOSDeviceZero; device.iPad = YES;
+ currentOrientation = UIInterfaceOrientationLandscapeRight;
+ name = [self.plugin getImageName:currentOrientation delegate:delegate2 device:device];
+ XCTAssertTrue([@"Default-Portrait" isEqualToString:name], @"Portrait - iPad failed (%@)", name);
+
+ // Portrait, iPad - should always return Portrait
+ device = CDV_iOSDeviceZero; device.iPad = YES;
+ currentOrientation = UIInterfaceOrientationPortrait;
+ name = [self.plugin getImageName:currentOrientation delegate:delegate2 device:device];
+ XCTAssertTrue([@"Default-Portrait" isEqualToString:name], @"Portrait - iPad failed (%@)", name);
+
+ // PortraitUpsideDown, iPad - should always return Portrait
+ device = CDV_iOSDeviceZero; device.iPad = YES;
+ currentOrientation = UIInterfaceOrientationPortraitUpsideDown;
+ name = [self.plugin getImageName:currentOrientation delegate:delegate2 device:device];
+ XCTAssertTrue([@"Default-Portrait" isEqualToString:name], @"Portrait - iPad failed (%@)", name);
+
+
+ /// LANDSCAPE LEFT
+
+ LandscapeLeftOnly* delegate3 = [[LandscapeLeftOnly alloc] init];
+
+ // LandscapeLeft, iPad - should always return Landscape
+ device = CDV_iOSDeviceZero; device.iPad = YES;
+ currentOrientation = UIInterfaceOrientationLandscapeLeft;
+ name = [self.plugin getImageName:currentOrientation delegate:delegate3 device:device];
+ XCTAssertTrue([@"Default-Landscape" isEqualToString:name], @"Landscape - iPad failed (%@)", name);
+
+ // LandscapeRight, iPad - should always return Landscape
+ device = CDV_iOSDeviceZero; device.iPad = YES;
+ currentOrientation = UIInterfaceOrientationLandscapeRight;
+ name = [self.plugin getImageName:currentOrientation delegate:delegate3 device:device];
+ XCTAssertTrue([@"Default-Landscape" isEqualToString:name], @"Landscape - iPad failed (%@)", name);
+
+ // Portrait, iPad - should always return Landscape
+ device = CDV_iOSDeviceZero; device.iPad = YES;
+ currentOrientation = UIInterfaceOrientationPortrait;
+ name = [self.plugin getImageName:currentOrientation delegate:delegate3 device:device];
+ XCTAssertTrue([@"Default-Landscape" isEqualToString:name], @"Landscape - iPad failed (%@)", name);
+
+ // PortraitUpsideDown, iPad - should always return Landscape
+ device = CDV_iOSDeviceZero; device.iPad = YES;
+ currentOrientation = UIInterfaceOrientationPortraitUpsideDown;
+ name = [self.plugin getImageName:currentOrientation delegate:delegate3 device:device];
+ XCTAssertTrue([@"Default-Landscape" isEqualToString:name], @"Landscape - iPad failed (%@)", name);
+
+ /// LANDSCAPE RIGHT
+
+ LandscapeRightOnly* delegate4 = [[LandscapeRightOnly alloc] init];
+
+ // LandscapeLeft, iPad - should always return Landscape
+ device = CDV_iOSDeviceZero; device.iPad = YES;
+ currentOrientation = UIInterfaceOrientationLandscapeLeft;
+ name = [self.plugin getImageName:currentOrientation delegate:delegate4 device:device];
+ XCTAssertTrue([@"Default-Landscape" isEqualToString:name], @"Landscape - iPad failed (%@)", name);
+
+ // LandscapeRight, iPad - should always return Landscape
+ device = CDV_iOSDeviceZero; device.iPad = YES;
+ currentOrientation = UIInterfaceOrientationLandscapeRight;
+ name = [self.plugin getImageName:currentOrientation delegate:delegate4 device:device];
+ XCTAssertTrue([@"Default-Landscape" isEqualToString:name], @"Landscape - iPad failed (%@)", name);
+
+ // Portrait, iPad - should always return Landscape
+ device = CDV_iOSDeviceZero; device.iPad = YES;
+ currentOrientation = UIInterfaceOrientationPortrait;
+ name = [self.plugin getImageName:currentOrientation delegate:delegate4 device:device];
+ XCTAssertTrue([@"Default-Landscape" isEqualToString:name], @"Landscape - iPad failed (%@)", name);
+
+ // PortraitUpsideDown, iPad - should always return Landscape
+ device = CDV_iOSDeviceZero; device.iPad = YES;
+ currentOrientation = UIInterfaceOrientationPortraitUpsideDown;
+ name = [self.plugin getImageName:currentOrientation delegate:delegate4 device:device];
+ XCTAssertTrue([@"Default-Landscape" isEqualToString:name], @"Landscape - iPad failed (%@)", name);
+
+ // TODO: Mixed environments
+
+}
+
+
@end