PageRenderTime 48ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/front/plugins/cordova-plugin-splashscreen/tests/ios/CDVSplashScreenTest/CDVSplashScreenLibTests/ImageNameTest.m

https://gitlab.com/boxnia/NFU_MOVIL
Objective C | 702 lines | 506 code | 131 blank | 65 comment | 0 complexity | cede95c794efcbc7997bbb8ff610cbfb MD5 | raw file
  1. /*
  2. Licensed to the Apache Software Foundation (ASF) under one
  3. or more contributor license agreements. See the NOTICE file
  4. distributed with this work for additional information
  5. regarding copyright ownership. The ASF licenses this file
  6. to you under the Apache License, Version 2.0 (the
  7. "License"); you may not use this file except in compliance
  8. with the License. You may obtain a copy of the License at
  9. http://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing,
  11. software distributed under the License is distributed on an
  12. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  13. KIND, either express or implied. See the License for the
  14. specific language governing permissions and limitations
  15. under the License.
  16. */
  17. #import <UIKit/UIKit.h>
  18. #import <XCTest/XCTest.h>
  19. #import <Cordova/CDVScreenOrientationDelegate.h>
  20. #import "CDVSplashScreen.h"
  21. #import "ImageNameTestDelegates.h"
  22. const CDV_iOSDevice CDV_iOSDeviceZero = { 0, 0, 0, 0, 0, 0 };
  23. @interface ImageNameTest : XCTestCase
  24. @property (nonatomic, strong) CDVSplashScreen* plugin;
  25. @end
  26. @interface CDVSplashScreen ()
  27. // expose private interface
  28. - (NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(id<CDVScreenOrientationDelegate>)orientationDelegate device:(CDV_iOSDevice)device;
  29. @end
  30. @implementation ImageNameTest
  31. - (void)setUp {
  32. [super setUp];
  33. // Put setup code here. This method is called before the invocation of each test method in the class.
  34. self.plugin = [[CDVSplashScreen alloc] init];
  35. }
  36. - (void)tearDown {
  37. // Put teardown code here. This method is called after the invocation of each test method in the class.
  38. [super tearDown];
  39. }
  40. - (void) orientationHelper:(id<CDVScreenOrientationDelegate>)delegate expectedImageNameDictionary:(NSDictionary*)expectedImageNameDictionary device:(CDV_iOSDevice)device{
  41. NSString* name = nil;
  42. NSString* expectedImageName = nil;
  43. UIInterfaceOrientation currentOrientation;
  44. NSString* deviceName = device.iPad? @"iPad" : device.iPhone6Plus? @"iPhone6Plus": device.iPhone6? @"iPhone6": device.iPhone5? @"iPhone5" : @"iPhone";
  45. // LandscapeLeft, should always return expectedImageName
  46. currentOrientation = UIInterfaceOrientationLandscapeLeft;
  47. name = [self.plugin getImageName:currentOrientation delegate:delegate device:device];
  48. expectedImageName = [expectedImageNameDictionary objectForKey:@"landscapeLeft"];
  49. XCTAssertTrue([expectedImageName isEqualToString:name], @"%@ - %@ failed (%@)", @"Landscape", deviceName, name);
  50. // LandscapeRight - should always return expectedImageName
  51. currentOrientation = UIInterfaceOrientationLandscapeRight;
  52. name = [self.plugin getImageName:currentOrientation delegate:delegate device:device];
  53. expectedImageName = [expectedImageNameDictionary objectForKey:@"landscapeRight"];
  54. XCTAssertTrue([expectedImageName isEqualToString:name], @"%@ - %@ failed (%@)", @"Landscape", deviceName, name);
  55. // Portrait - should always return expectedImageName
  56. currentOrientation = UIInterfaceOrientationPortrait;
  57. name = [self.plugin getImageName:currentOrientation delegate:delegate device:device];
  58. expectedImageName = [expectedImageNameDictionary objectForKey:@"portrait"];
  59. XCTAssertTrue([expectedImageName isEqualToString:name], @"%@ - %@ failed (%@)", @"Portrait", deviceName, name);
  60. // PortraitUpsideDown - should always return expectedImageName
  61. currentOrientation = UIInterfaceOrientationPortraitUpsideDown;
  62. name = [self.plugin getImageName:currentOrientation delegate:delegate device:device];
  63. expectedImageName = [expectedImageNameDictionary objectForKey:@"portraitUpsideDown"];
  64. XCTAssertTrue([expectedImageName isEqualToString:name], @"%@ - %@ failed (%@)", @"Portrait", deviceName, name);
  65. }
  66. - (void)testiPadOrientation {
  67. CDV_iOSDevice device = CDV_iOSDeviceZero;
  68. device.iPad = YES;
  69. // One orientation
  70. PortraitOnly* delegate = [[PortraitOnly alloc] init];
  71. [self orientationHelper:delegate expectedImageNameDictionary:@{
  72. @"landscapeLeft" : @"Default-Portrait",
  73. @"landscapeRight" : @"Default-Portrait",
  74. @"portrait" : @"Default-Portrait",
  75. @"portraitUpsideDown" : @"Default-Portrait"
  76. }
  77. device:device];
  78. PortraitUpsideDownOnly* delegate2 = [[PortraitUpsideDownOnly alloc] init];
  79. [self orientationHelper:delegate2 expectedImageNameDictionary:@{
  80. @"landscapeLeft" : @"Default-Portrait",
  81. @"landscapeRight" : @"Default-Portrait",
  82. @"portrait" : @"Default-Portrait",
  83. @"portraitUpsideDown" : @"Default-Portrait"
  84. }
  85. device:device];
  86. LandscapeLeftOnly* delegate3 = [[LandscapeLeftOnly alloc] init];
  87. [self orientationHelper:delegate3 expectedImageNameDictionary:@{
  88. @"landscapeLeft" : @"Default-Landscape",
  89. @"landscapeRight" : @"Default-Landscape",
  90. @"portrait" : @"Default-Landscape",
  91. @"portraitUpsideDown" : @"Default-Landscape"
  92. }
  93. device:device];
  94. LandscapeRightOnly* delegate4 = [[LandscapeRightOnly alloc] init];
  95. [self orientationHelper:delegate4 expectedImageNameDictionary:@{
  96. @"landscapeLeft" : @"Default-Landscape",
  97. @"landscapeRight" : @"Default-Landscape",
  98. @"portrait" : @"Default-Landscape",
  99. @"portraitUpsideDown" : @"Default-Landscape"
  100. }
  101. device:device];
  102. // All Portrait
  103. AllPortraitOnly* delegate5 = [[AllPortraitOnly alloc] init];
  104. [self orientationHelper:delegate5 expectedImageNameDictionary:@{
  105. @"landscapeLeft" : @"Default-Portrait",
  106. @"landscapeRight" : @"Default-Portrait",
  107. @"portrait" : @"Default-Portrait",
  108. @"portraitUpsideDown" : @"Default-Portrait"
  109. }
  110. device:device];
  111. // All Landscape
  112. AllLandscapeOnly* delegate6 = [[AllLandscapeOnly alloc] init];
  113. [self orientationHelper:delegate6 expectedImageNameDictionary:@{
  114. @"landscapeLeft" : @"Default-Landscape",
  115. @"landscapeRight" : @"Default-Landscape",
  116. @"portrait" : @"Default-Landscape",
  117. @"portraitUpsideDown" : @"Default-Landscape"
  118. }
  119. device:device];
  120. // All orientations
  121. AllOrientations* delegate7 = [[AllOrientations alloc] init];
  122. [self orientationHelper:delegate7 expectedImageNameDictionary:@{
  123. @"landscapeLeft" : @"Default-Landscape",
  124. @"landscapeRight" : @"Default-Landscape",
  125. @"portrait" : @"Default-Portrait",
  126. @"portraitUpsideDown" : @"Default-Portrait"
  127. }
  128. device:device];
  129. // Portrait and Landscape Left
  130. PortraitAndLandscapeLeftOnly* delegate8 = [[PortraitAndLandscapeLeftOnly alloc] init];
  131. [self orientationHelper:delegate8 expectedImageNameDictionary:@{
  132. @"landscapeLeft" : @"Default-Landscape",
  133. @"landscapeRight" : @"Default-Landscape",
  134. @"portrait" : @"Default-Portrait",
  135. @"portraitUpsideDown" : @"Default-Portrait"
  136. }
  137. device:device];
  138. // Portrait and Landscape Right
  139. PortraitAndLandscapeRightOnly* delegate9 = [[PortraitAndLandscapeRightOnly alloc] init];
  140. [self orientationHelper:delegate9 expectedImageNameDictionary:@{
  141. @"landscapeLeft" : @"Default-Landscape",
  142. @"landscapeRight" : @"Default-Landscape",
  143. @"portrait" : @"Default-Portrait",
  144. @"portraitUpsideDown" : @"Default-Portrait"
  145. }
  146. device:device];
  147. // PortraitUpsideDown and Landscape Left
  148. PortraitUpsideDownAndLandscapeLeftOnly* delegate10 = [[PortraitUpsideDownAndLandscapeLeftOnly alloc] init];
  149. [self orientationHelper:delegate10 expectedImageNameDictionary:@{
  150. @"landscapeLeft" : @"Default-Landscape",
  151. @"landscapeRight" : @"Default-Landscape",
  152. @"portrait" : @"Default-Portrait",
  153. @"portraitUpsideDown" : @"Default-Portrait"
  154. }
  155. device:device];
  156. // PortraitUpsideDown and Landscape Right
  157. PortraitUpsideDownAndLandscapeRightOnly* delegate11 = [[PortraitUpsideDownAndLandscapeRightOnly alloc] init];
  158. [self orientationHelper:delegate11 expectedImageNameDictionary:@{
  159. @"landscapeLeft" : @"Default-Landscape",
  160. @"landscapeRight" : @"Default-Landscape",
  161. @"portrait" : @"Default-Portrait",
  162. @"portraitUpsideDown" : @"Default-Portrait"
  163. }
  164. device:device];
  165. }
  166. - (void)testiPhoneOrientation {
  167. CDV_iOSDevice device = CDV_iOSDeviceZero;
  168. device.iPhone = YES;
  169. // One orientation
  170. PortraitOnly* delegate = [[PortraitOnly alloc] init];
  171. [self orientationHelper:delegate expectedImageNameDictionary:@{
  172. @"landscapeLeft" : @"Default",
  173. @"landscapeRight" : @"Default",
  174. @"portrait" : @"Default",
  175. @"portraitUpsideDown" : @"Default"
  176. }
  177. device:device];
  178. PortraitUpsideDownOnly* delegate2 = [[PortraitUpsideDownOnly alloc] init];
  179. [self orientationHelper:delegate2 expectedImageNameDictionary:@{
  180. @"landscapeLeft" : @"Default",
  181. @"landscapeRight" : @"Default",
  182. @"portrait" : @"Default",
  183. @"portraitUpsideDown" : @"Default"
  184. }
  185. device:device];
  186. LandscapeLeftOnly* delegate3 = [[LandscapeLeftOnly alloc] init];
  187. [self orientationHelper:delegate3 expectedImageNameDictionary:@{
  188. @"landscapeLeft" : @"Default",
  189. @"landscapeRight" : @"Default",
  190. @"portrait" : @"Default",
  191. @"portraitUpsideDown" : @"Default"
  192. }
  193. device:device];
  194. LandscapeRightOnly* delegate4 = [[LandscapeRightOnly alloc] init];
  195. [self orientationHelper:delegate4 expectedImageNameDictionary:@{
  196. @"landscapeLeft" : @"Default",
  197. @"landscapeRight" : @"Default",
  198. @"portrait" : @"Default",
  199. @"portraitUpsideDown" : @"Default"
  200. }
  201. device:device];
  202. // All Portrait
  203. AllPortraitOnly* delegate5 = [[AllPortraitOnly alloc] init];
  204. [self orientationHelper:delegate5 expectedImageNameDictionary:@{
  205. @"landscapeLeft" : @"Default",
  206. @"landscapeRight" : @"Default",
  207. @"portrait" : @"Default",
  208. @"portraitUpsideDown" : @"Default"
  209. }
  210. device:device];
  211. // All Landscape
  212. AllLandscapeOnly* delegate6 = [[AllLandscapeOnly alloc] init];
  213. [self orientationHelper:delegate6 expectedImageNameDictionary:@{
  214. @"landscapeLeft" : @"Default",
  215. @"landscapeRight" : @"Default",
  216. @"portrait" : @"Default",
  217. @"portraitUpsideDown" : @"Default"
  218. }
  219. device:device];
  220. // All orientations
  221. AllOrientations* delegate7 = [[AllOrientations alloc] init];
  222. [self orientationHelper:delegate7 expectedImageNameDictionary:@{
  223. @"landscapeLeft" : @"Default",
  224. @"landscapeRight" : @"Default",
  225. @"portrait" : @"Default",
  226. @"portraitUpsideDown" : @"Default"
  227. }
  228. device:device];
  229. // Portrait and Landscape Left
  230. PortraitAndLandscapeLeftOnly* delegate8 = [[PortraitAndLandscapeLeftOnly alloc] init];
  231. [self orientationHelper:delegate8 expectedImageNameDictionary:@{
  232. @"landscapeLeft" : @"Default",
  233. @"landscapeRight" : @"Default",
  234. @"portrait" : @"Default",
  235. @"portraitUpsideDown" : @"Default"
  236. }
  237. device:device];
  238. // Portrait and Landscape Right
  239. PortraitAndLandscapeRightOnly* delegate9 = [[PortraitAndLandscapeRightOnly alloc] init];
  240. [self orientationHelper:delegate9 expectedImageNameDictionary:@{
  241. @"landscapeLeft" : @"Default",
  242. @"landscapeRight" : @"Default",
  243. @"portrait" : @"Default",
  244. @"portraitUpsideDown" : @"Default"
  245. }
  246. device:device];
  247. // PortraitUpsideDown and Landscape Left
  248. PortraitUpsideDownAndLandscapeLeftOnly* delegate10 = [[PortraitUpsideDownAndLandscapeLeftOnly alloc] init];
  249. [self orientationHelper:delegate10 expectedImageNameDictionary:@{
  250. @"landscapeLeft" : @"Default",
  251. @"landscapeRight" : @"Default",
  252. @"portrait" : @"Default",
  253. @"portraitUpsideDown" : @"Default"
  254. }
  255. device:device];
  256. // PortraitUpsideDown and Landscape Right
  257. PortraitUpsideDownAndLandscapeRightOnly* delegate11 = [[PortraitUpsideDownAndLandscapeRightOnly alloc] init];
  258. [self orientationHelper:delegate11 expectedImageNameDictionary:@{
  259. @"landscapeLeft" : @"Default",
  260. @"landscapeRight" : @"Default",
  261. @"portrait" : @"Default",
  262. @"portraitUpsideDown" : @"Default"
  263. }
  264. device:device];
  265. }
  266. - (void)testiPhone5Orientation {
  267. CDV_iOSDevice device = CDV_iOSDeviceZero;
  268. device.iPhone = YES;
  269. device.iPhone5 = YES;
  270. // One orientation
  271. PortraitOnly* delegate = [[PortraitOnly alloc] init];
  272. [self orientationHelper:delegate expectedImageNameDictionary:@{
  273. @"landscapeLeft" : @"Default-568h",
  274. @"landscapeRight" : @"Default-568h",
  275. @"portrait" : @"Default-568h",
  276. @"portraitUpsideDown" : @"Default-568h"
  277. }
  278. device:device];
  279. PortraitUpsideDownOnly* delegate2 = [[PortraitUpsideDownOnly alloc] init];
  280. [self orientationHelper:delegate2 expectedImageNameDictionary:@{
  281. @"landscapeLeft" : @"Default-568h",
  282. @"landscapeRight" : @"Default-568h",
  283. @"portrait" : @"Default-568h",
  284. @"portraitUpsideDown" : @"Default-568h"
  285. }
  286. device:device];
  287. LandscapeLeftOnly* delegate3 = [[LandscapeLeftOnly alloc] init];
  288. [self orientationHelper:delegate3 expectedImageNameDictionary:@{
  289. @"landscapeLeft" : @"Default-568h",
  290. @"landscapeRight" : @"Default-568h",
  291. @"portrait" : @"Default-568h",
  292. @"portraitUpsideDown" : @"Default-568h"
  293. }
  294. device:device];
  295. LandscapeRightOnly* delegate4 = [[LandscapeRightOnly alloc] init];
  296. [self orientationHelper:delegate4 expectedImageNameDictionary:@{
  297. @"landscapeLeft" : @"Default-568h",
  298. @"landscapeRight" : @"Default-568h",
  299. @"portrait" : @"Default-568h",
  300. @"portraitUpsideDown" : @"Default-568h"
  301. }
  302. device:device];
  303. // All Portrait
  304. AllPortraitOnly* delegate5 = [[AllPortraitOnly alloc] init];
  305. [self orientationHelper:delegate5 expectedImageNameDictionary:@{
  306. @"landscapeLeft" : @"Default-568h",
  307. @"landscapeRight" : @"Default-568h",
  308. @"portrait" : @"Default-568h",
  309. @"portraitUpsideDown" : @"Default-568h"
  310. }
  311. device:device];
  312. // All Landscape
  313. AllLandscapeOnly* delegate6 = [[AllLandscapeOnly alloc] init];
  314. [self orientationHelper:delegate6 expectedImageNameDictionary:@{
  315. @"landscapeLeft" : @"Default-568h",
  316. @"landscapeRight" : @"Default-568h",
  317. @"portrait" : @"Default-568h",
  318. @"portraitUpsideDown" : @"Default-568h"
  319. }
  320. device:device];
  321. // All orientations
  322. AllOrientations* delegate7 = [[AllOrientations alloc] init];
  323. [self orientationHelper:delegate7 expectedImageNameDictionary:@{
  324. @"landscapeLeft" : @"Default-568h",
  325. @"landscapeRight" : @"Default-568h",
  326. @"portrait" : @"Default-568h",
  327. @"portraitUpsideDown" : @"Default-568h"
  328. }
  329. device:device];
  330. // Portrait and Landscape Left
  331. PortraitAndLandscapeLeftOnly* delegate8 = [[PortraitAndLandscapeLeftOnly alloc] init];
  332. [self orientationHelper:delegate8 expectedImageNameDictionary:@{
  333. @"landscapeLeft" : @"Default-568h",
  334. @"landscapeRight" : @"Default-568h",
  335. @"portrait" : @"Default-568h",
  336. @"portraitUpsideDown" : @"Default-568h"
  337. }
  338. device:device];
  339. // Portrait and Landscape Right
  340. PortraitAndLandscapeRightOnly* delegate9 = [[PortraitAndLandscapeRightOnly alloc] init];
  341. [self orientationHelper:delegate9 expectedImageNameDictionary:@{
  342. @"landscapeLeft" : @"Default-568h",
  343. @"landscapeRight" : @"Default-568h",
  344. @"portrait" : @"Default-568h",
  345. @"portraitUpsideDown" : @"Default-568h"
  346. }
  347. device:device];
  348. // PortraitUpsideDown and Landscape Left
  349. PortraitUpsideDownAndLandscapeLeftOnly* delegate10 = [[PortraitUpsideDownAndLandscapeLeftOnly alloc] init];
  350. [self orientationHelper:delegate10 expectedImageNameDictionary:@{
  351. @"landscapeLeft" : @"Default-568h",
  352. @"landscapeRight" : @"Default-568h",
  353. @"portrait" : @"Default-568h",
  354. @"portraitUpsideDown" : @"Default-568h"
  355. }
  356. device:device];
  357. // PortraitUpsideDown and Landscape Right
  358. PortraitUpsideDownAndLandscapeRightOnly* delegate11 = [[PortraitUpsideDownAndLandscapeRightOnly alloc] init];
  359. [self orientationHelper:delegate11 expectedImageNameDictionary:@{
  360. @"landscapeLeft" : @"Default-568h",
  361. @"landscapeRight" : @"Default-568h",
  362. @"portrait" : @"Default-568h",
  363. @"portraitUpsideDown" : @"Default-568h"
  364. }
  365. device:device];
  366. }
  367. - (void)testiPhone6Orientation {
  368. CDV_iOSDevice device = CDV_iOSDeviceZero;
  369. device.iPhone = YES;
  370. device.iPhone6 = YES;
  371. // One orientation
  372. PortraitOnly* delegate = [[PortraitOnly alloc] init];
  373. [self orientationHelper:delegate expectedImageNameDictionary:@{
  374. @"landscapeLeft" : @"Default-667h",
  375. @"landscapeRight" : @"Default-667h",
  376. @"portrait" : @"Default-667h",
  377. @"portraitUpsideDown" : @"Default-667h"
  378. }
  379. device:device];
  380. PortraitUpsideDownOnly* delegate2 = [[PortraitUpsideDownOnly alloc] init];
  381. [self orientationHelper:delegate2 expectedImageNameDictionary:@{
  382. @"landscapeLeft" : @"Default-667h",
  383. @"landscapeRight" : @"Default-667h",
  384. @"portrait" : @"Default-667h",
  385. @"portraitUpsideDown" : @"Default-667h"
  386. }
  387. device:device];
  388. LandscapeLeftOnly* delegate3 = [[LandscapeLeftOnly alloc] init];
  389. [self orientationHelper:delegate3 expectedImageNameDictionary:@{
  390. @"landscapeLeft" : @"Default-667h",
  391. @"landscapeRight" : @"Default-667h",
  392. @"portrait" : @"Default-667h",
  393. @"portraitUpsideDown" : @"Default-667h"
  394. }
  395. device:device];
  396. LandscapeRightOnly* delegate4 = [[LandscapeRightOnly alloc] init];
  397. [self orientationHelper:delegate4 expectedImageNameDictionary:@{
  398. @"landscapeLeft" : @"Default-667h",
  399. @"landscapeRight" : @"Default-667h",
  400. @"portrait" : @"Default-667h",
  401. @"portraitUpsideDown" : @"Default-667h"
  402. }
  403. device:device];
  404. // All Portrait
  405. AllPortraitOnly* delegate5 = [[AllPortraitOnly alloc] init];
  406. [self orientationHelper:delegate5 expectedImageNameDictionary:@{
  407. @"landscapeLeft" : @"Default-667h",
  408. @"landscapeRight" : @"Default-667h",
  409. @"portrait" : @"Default-667h",
  410. @"portraitUpsideDown" : @"Default-667h"
  411. }
  412. device:device];
  413. // All Landscape
  414. AllLandscapeOnly* delegate6 = [[AllLandscapeOnly alloc] init];
  415. [self orientationHelper:delegate6 expectedImageNameDictionary:@{
  416. @"landscapeLeft" : @"Default-667h",
  417. @"landscapeRight" : @"Default-667h",
  418. @"portrait" : @"Default-667h",
  419. @"portraitUpsideDown" : @"Default-667h"
  420. }
  421. device:device];
  422. // All orientations
  423. AllOrientations* delegate7 = [[AllOrientations alloc] init];
  424. [self orientationHelper:delegate7 expectedImageNameDictionary:@{
  425. @"landscapeLeft" : @"Default-667h",
  426. @"landscapeRight" : @"Default-667h",
  427. @"portrait" : @"Default-667h",
  428. @"portraitUpsideDown" : @"Default-667h"
  429. }
  430. device:device];
  431. // Portrait and Landscape Left
  432. PortraitAndLandscapeLeftOnly* delegate8 = [[PortraitAndLandscapeLeftOnly alloc] init];
  433. [self orientationHelper:delegate8 expectedImageNameDictionary:@{
  434. @"landscapeLeft" : @"Default-667h",
  435. @"landscapeRight" : @"Default-667h",
  436. @"portrait" : @"Default-667h",
  437. @"portraitUpsideDown" : @"Default-667h"
  438. }
  439. device:device];
  440. // Portrait and Landscape Right
  441. PortraitAndLandscapeRightOnly* delegate9 = [[PortraitAndLandscapeRightOnly alloc] init];
  442. [self orientationHelper:delegate9 expectedImageNameDictionary:@{
  443. @"landscapeLeft" : @"Default-667h",
  444. @"landscapeRight" : @"Default-667h",
  445. @"portrait" : @"Default-667h",
  446. @"portraitUpsideDown" : @"Default-667h"
  447. }
  448. device:device];
  449. // PortraitUpsideDown and Landscape Left
  450. PortraitUpsideDownAndLandscapeLeftOnly* delegate10 = [[PortraitUpsideDownAndLandscapeLeftOnly alloc] init];
  451. [self orientationHelper:delegate10 expectedImageNameDictionary:@{
  452. @"landscapeLeft" : @"Default-667h",
  453. @"landscapeRight" : @"Default-667h",
  454. @"portrait" : @"Default-667h",
  455. @"portraitUpsideDown" : @"Default-667h"
  456. }
  457. device:device];
  458. // PortraitUpsideDown and Landscape Right
  459. PortraitUpsideDownAndLandscapeRightOnly* delegate11 = [[PortraitUpsideDownAndLandscapeRightOnly alloc] init];
  460. [self orientationHelper:delegate11 expectedImageNameDictionary:@{
  461. @"landscapeLeft" : @"Default-667h",
  462. @"landscapeRight" : @"Default-667h",
  463. @"portrait" : @"Default-667h",
  464. @"portraitUpsideDown" : @"Default-667h"
  465. }
  466. device:device];
  467. }
  468. - (void)testiPhone6PlusOrientation {
  469. CDV_iOSDevice device = CDV_iOSDeviceZero;
  470. device.iPhone = YES;
  471. device.iPhone6Plus = YES;
  472. // One orientation
  473. PortraitOnly* delegate = [[PortraitOnly alloc] init];
  474. [self orientationHelper:delegate expectedImageNameDictionary:@{
  475. @"landscapeLeft" : @"Default-736h",
  476. @"landscapeRight" : @"Default-736h",
  477. @"portrait" : @"Default-736h",
  478. @"portraitUpsideDown" : @"Default-736h"
  479. }
  480. device:device];
  481. PortraitUpsideDownOnly* delegate2 = [[PortraitUpsideDownOnly alloc] init];
  482. [self orientationHelper:delegate2 expectedImageNameDictionary:@{
  483. @"landscapeLeft" : @"Default-736h",
  484. @"landscapeRight" : @"Default-736h",
  485. @"portrait" : @"Default-736h",
  486. @"portraitUpsideDown" : @"Default-736h"
  487. }
  488. device:device];
  489. LandscapeLeftOnly* delegate3 = [[LandscapeLeftOnly alloc] init];
  490. [self orientationHelper:delegate3 expectedImageNameDictionary:@{
  491. @"landscapeLeft" : @"Default-Landscape-736h",
  492. @"landscapeRight" : @"Default-Landscape-736h",
  493. @"portrait" : @"Default-Landscape-736h",
  494. @"portraitUpsideDown" : @"Default-Landscape-736h"
  495. }
  496. device:device];
  497. LandscapeRightOnly* delegate4 = [[LandscapeRightOnly alloc] init];
  498. [self orientationHelper:delegate4 expectedImageNameDictionary:@{
  499. @"landscapeLeft" : @"Default-Landscape-736h",
  500. @"landscapeRight" : @"Default-Landscape-736h",
  501. @"portrait" : @"Default-Landscape-736h",
  502. @"portraitUpsideDown" : @"Default-Landscape-736h"
  503. }
  504. device:device];
  505. // All Portrait
  506. AllPortraitOnly* delegate5 = [[AllPortraitOnly alloc] init];
  507. [self orientationHelper:delegate5 expectedImageNameDictionary:@{
  508. @"landscapeLeft" : @"Default-736h",
  509. @"landscapeRight" : @"Default-736h",
  510. @"portrait" : @"Default-736h",
  511. @"portraitUpsideDown" : @"Default-736h"
  512. }
  513. device:device];
  514. // All Landscape
  515. AllLandscapeOnly* delegate6 = [[AllLandscapeOnly alloc] init];
  516. [self orientationHelper:delegate6 expectedImageNameDictionary:@{
  517. @"landscapeLeft" : @"Default-Landscape-736h",
  518. @"landscapeRight" : @"Default-Landscape-736h",
  519. @"portrait" : @"Default-Landscape-736h",
  520. @"portraitUpsideDown" : @"Default-Landscape-736h"
  521. }
  522. device:device];
  523. // All orientations
  524. AllOrientations* delegate7 = [[AllOrientations alloc] init];
  525. [self orientationHelper:delegate7 expectedImageNameDictionary:@{
  526. @"landscapeLeft" : @"Default-Landscape-736h",
  527. @"landscapeRight" : @"Default-Landscape-736h",
  528. @"portrait" : @"Default-736h",
  529. @"portraitUpsideDown" : @"Default-736h"
  530. }
  531. device:device];
  532. // Portrait and Landscape Left
  533. PortraitAndLandscapeLeftOnly* delegate8 = [[PortraitAndLandscapeLeftOnly alloc] init];
  534. [self orientationHelper:delegate8 expectedImageNameDictionary:@{
  535. @"landscapeLeft" : @"Default-Landscape-736h",
  536. @"landscapeRight" : @"Default-Landscape-736h",
  537. @"portrait" : @"Default-736h",
  538. @"portraitUpsideDown" : @"Default-736h"
  539. }
  540. device:device];
  541. // Portrait and Landscape Right
  542. PortraitAndLandscapeRightOnly* delegate9 = [[PortraitAndLandscapeRightOnly alloc] init];
  543. [self orientationHelper:delegate9 expectedImageNameDictionary:@{
  544. @"landscapeLeft" : @"Default-Landscape-736h",
  545. @"landscapeRight" : @"Default-Landscape-736h",
  546. @"portrait" : @"Default-736h",
  547. @"portraitUpsideDown" : @"Default-736h"
  548. }
  549. device:device];
  550. // PortraitUpsideDown and Landscape Left
  551. PortraitUpsideDownAndLandscapeLeftOnly* delegate10 = [[PortraitUpsideDownAndLandscapeLeftOnly alloc] init];
  552. [self orientationHelper:delegate10 expectedImageNameDictionary:@{
  553. @"landscapeLeft" : @"Default-Landscape-736h",
  554. @"landscapeRight" : @"Default-Landscape-736h",
  555. @"portrait" : @"Default-736h",
  556. @"portraitUpsideDown" : @"Default-736h"
  557. }
  558. device:device];
  559. // PortraitUpsideDown and Landscape Right
  560. PortraitUpsideDownAndLandscapeRightOnly* delegate11 = [[PortraitUpsideDownAndLandscapeRightOnly alloc] init];
  561. [self orientationHelper:delegate11 expectedImageNameDictionary:@{
  562. @"landscapeLeft" : @"Default-Landscape-736h",
  563. @"landscapeRight" : @"Default-Landscape-736h",
  564. @"portrait" : @"Default-736h",
  565. @"portraitUpsideDown" : @"Default-736h"
  566. }
  567. device:device];
  568. }
  569. @end