openEventsPlatformApp/plugins/cordova-plugin-splashscreen/tests/ios/CDVSplashScreenTest/CDVSplashScreenLibTests/ImageNameTest.m
plugins/cordova-plugin-splashscreen/tests/ios/CDVSplashScreenTest/CDVSplashScreenLibTests/ImageNameTest.mRaw
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
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing,
13 software distributed under the License is distributed on an
14 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 KIND, either express or implied. See the License for the
16 specific language governing permissions and limitations
17 under the License.
18 */
19
20#import <UIKit/UIKit.h>
21#import <XCTest/XCTest.h>
22#import <Cordova/CDVScreenOrientationDelegate.h>
23#import "CDVSplashScreen.h"
24#import "ImageNameTestDelegates.h"
25
26const CDV_iOSDevice CDV_iOSDeviceZero = { 0, 0, 0, 0, 0, 0 };
27
28@interface ImageNameTest : XCTestCase
29
30@property (nonatomic, strong) CDVSplashScreen* plugin;
31
32@end
33
34@interface CDVSplashScreen ()
35
36// expose private interface
37- (NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(id<CDVScreenOrientationDelegate>)orientationDelegate device:(CDV_iOSDevice)device;
38
39@end
40
41@implementation ImageNameTest
42
43- (void)setUp {
44 [super setUp];
45 // Put setup code here. This method is called before the invocation of each test method in the class.
46
47 self.plugin = [[CDVSplashScreen alloc] init];
48}
49
50- (void)tearDown {
51 // Put teardown code here. This method is called after the invocation of each test method in the class.
52 [super tearDown];
53}
54
55- (void) orientationHelper:(id<CDVScreenOrientationDelegate>)delegate expectedImageNameDictionary:(NSDictionary*)expectedImageNameDictionary device:(CDV_iOSDevice)device{
56
57 NSString* name = nil;
58 NSString* expectedImageName = nil;
59 UIInterfaceOrientation currentOrientation;
60 NSString* deviceName = device.iPad? @"iPad" : device.iPhone6Plus? @"iPhone6Plus": device.iPhone6? @"iPhone6": device.iPhone5? @"iPhone5" : @"iPhone";
61
62 // LandscapeLeft, should always return expectedImageName
63 currentOrientation = UIInterfaceOrientationLandscapeLeft;
64 name = [self.plugin getImageName:currentOrientation delegate:delegate device:device];
65 expectedImageName = [expectedImageNameDictionary objectForKey:@"landscapeLeft"];
66 XCTAssertTrue([expectedImageName isEqualToString:name], @"%@ - %@ failed (%@)", @"Landscape", deviceName, name);
67
68 // LandscapeRight - should always return expectedImageName
69 currentOrientation = UIInterfaceOrientationLandscapeRight;
70 name = [self.plugin getImageName:currentOrientation delegate:delegate device:device];
71 expectedImageName = [expectedImageNameDictionary objectForKey:@"landscapeRight"];
72 XCTAssertTrue([expectedImageName isEqualToString:name], @"%@ - %@ failed (%@)", @"Landscape", deviceName, name);
73
74 // Portrait - should always return expectedImageName
75 currentOrientation = UIInterfaceOrientationPortrait;
76 name = [self.plugin getImageName:currentOrientation delegate:delegate device:device];
77 expectedImageName = [expectedImageNameDictionary objectForKey:@"portrait"];
78 XCTAssertTrue([expectedImageName isEqualToString:name], @"%@ - %@ failed (%@)", @"Portrait", deviceName, name);
79
80 // PortraitUpsideDown - should always return expectedImageName
81 currentOrientation = UIInterfaceOrientationPortraitUpsideDown;
82 name = [self.plugin getImageName:currentOrientation delegate:delegate device:device];
83 expectedImageName = [expectedImageNameDictionary objectForKey:@"portraitUpsideDown"];
84 XCTAssertTrue([expectedImageName isEqualToString:name], @"%@ - %@ failed (%@)", @"Portrait", deviceName, name);
85}
86
87- (void)testiPadOrientation {
88
89 CDV_iOSDevice device = CDV_iOSDeviceZero;
90 device.iPad = YES;
91
92 // One orientation
93
94 PortraitOnly* delegate = [[PortraitOnly alloc] init];
95 [self orientationHelper:delegate expectedImageNameDictionary:@{
96 @"landscapeLeft" : @"Default-Portrait",
97 @"landscapeRight" : @"Default-Portrait",
98 @"portrait" : @"Default-Portrait",
99 @"portraitUpsideDown" : @"Default-Portrait"
100 }
101 device:device];
102
103 PortraitUpsideDownOnly* delegate2 = [[PortraitUpsideDownOnly alloc] init];
104 [self orientationHelper:delegate2 expectedImageNameDictionary:@{
105 @"landscapeLeft" : @"Default-Portrait",
106 @"landscapeRight" : @"Default-Portrait",
107 @"portrait" : @"Default-Portrait",
108 @"portraitUpsideDown" : @"Default-Portrait"
109 }
110 device:device];
111
112 LandscapeLeftOnly* delegate3 = [[LandscapeLeftOnly alloc] init];
113 [self orientationHelper:delegate3 expectedImageNameDictionary:@{
114 @"landscapeLeft" : @"Default-Landscape",
115 @"landscapeRight" : @"Default-Landscape",
116 @"portrait" : @"Default-Landscape",
117 @"portraitUpsideDown" : @"Default-Landscape"
118 }
119 device:device];
120
121 LandscapeRightOnly* delegate4 = [[LandscapeRightOnly alloc] init];
122 [self orientationHelper:delegate4 expectedImageNameDictionary:@{
123 @"landscapeLeft" : @"Default-Landscape",
124 @"landscapeRight" : @"Default-Landscape",
125 @"portrait" : @"Default-Landscape",
126 @"portraitUpsideDown" : @"Default-Landscape"
127 }
128 device:device];
129
130 // All Portrait
131
132 AllPortraitOnly* delegate5 = [[AllPortraitOnly alloc] init];
133 [self orientationHelper:delegate5 expectedImageNameDictionary:@{
134 @"landscapeLeft" : @"Default-Portrait",
135 @"landscapeRight" : @"Default-Portrait",
136 @"portrait" : @"Default-Portrait",
137 @"portraitUpsideDown" : @"Default-Portrait"
138 }
139 device:device];
140
141 // All Landscape
142
143 AllLandscapeOnly* delegate6 = [[AllLandscapeOnly alloc] init];
144 [self orientationHelper:delegate6 expectedImageNameDictionary:@{
145 @"landscapeLeft" : @"Default-Landscape",
146 @"landscapeRight" : @"Default-Landscape",
147 @"portrait" : @"Default-Landscape",
148 @"portraitUpsideDown" : @"Default-Landscape"
149 }
150 device:device];
151
152
153 // All orientations
154
155 AllOrientations* delegate7 = [[AllOrientations alloc] init];
156 [self orientationHelper:delegate7 expectedImageNameDictionary:@{
157 @"landscapeLeft" : @"Default-Landscape",
158 @"landscapeRight" : @"Default-Landscape",
159 @"portrait" : @"Default-Portrait",
160 @"portraitUpsideDown" : @"Default-Portrait"
161 }
162 device:device];
163
164 // Portrait and Landscape Left
165
166 PortraitAndLandscapeLeftOnly* delegate8 = [[PortraitAndLandscapeLeftOnly alloc] init];
167 [self orientationHelper:delegate8 expectedImageNameDictionary:@{
168 @"landscapeLeft" : @"Default-Landscape",
169 @"landscapeRight" : @"Default-Landscape",
170 @"portrait" : @"Default-Portrait",
171 @"portraitUpsideDown" : @"Default-Portrait"
172 }
173 device:device];
174
175 // Portrait and Landscape Right
176
177 PortraitAndLandscapeRightOnly* delegate9 = [[PortraitAndLandscapeRightOnly alloc] init];
178 [self orientationHelper:delegate9 expectedImageNameDictionary:@{
179 @"landscapeLeft" : @"Default-Landscape",
180 @"landscapeRight" : @"Default-Landscape",
181 @"portrait" : @"Default-Portrait",
182 @"portraitUpsideDown" : @"Default-Portrait"
183 }
184 device:device];
185
186 // PortraitUpsideDown and Landscape Left
187
188 PortraitUpsideDownAndLandscapeLeftOnly* delegate10 = [[PortraitUpsideDownAndLandscapeLeftOnly alloc] init];
189 [self orientationHelper:delegate10 expectedImageNameDictionary:@{
190 @"landscapeLeft" : @"Default-Landscape",
191 @"landscapeRight" : @"Default-Landscape",
192 @"portrait" : @"Default-Portrait",
193 @"portraitUpsideDown" : @"Default-Portrait"
194 }
195 device:device];
196
197 // PortraitUpsideDown and Landscape Right
198
199 PortraitUpsideDownAndLandscapeRightOnly* delegate11 = [[PortraitUpsideDownAndLandscapeRightOnly alloc] init];
200 [self orientationHelper:delegate11 expectedImageNameDictionary:@{
201 @"landscapeLeft" : @"Default-Landscape",
202 @"landscapeRight" : @"Default-Landscape",
203 @"portrait" : @"Default-Portrait",
204 @"portraitUpsideDown" : @"Default-Portrait"
205 }
206 device:device];
207}
208
209- (void)testiPhoneOrientation {
210
211 CDV_iOSDevice device = CDV_iOSDeviceZero;
212 device.iPhone = YES;
213
214 // One orientation
215
216 PortraitOnly* delegate = [[PortraitOnly alloc] init];
217 [self orientationHelper:delegate expectedImageNameDictionary:@{
218 @"landscapeLeft" : @"Default",
219 @"landscapeRight" : @"Default",
220 @"portrait" : @"Default",
221 @"portraitUpsideDown" : @"Default"
222 }
223 device:device];
224
225 PortraitUpsideDownOnly* delegate2 = [[PortraitUpsideDownOnly alloc] init];
226 [self orientationHelper:delegate2 expectedImageNameDictionary:@{
227 @"landscapeLeft" : @"Default",
228 @"landscapeRight" : @"Default",
229 @"portrait" : @"Default",
230 @"portraitUpsideDown" : @"Default"
231 }
232 device:device];
233
234 LandscapeLeftOnly* delegate3 = [[LandscapeLeftOnly alloc] init];
235 [self orientationHelper:delegate3 expectedImageNameDictionary:@{
236 @"landscapeLeft" : @"Default",
237 @"landscapeRight" : @"Default",
238 @"portrait" : @"Default",
239 @"portraitUpsideDown" : @"Default"
240 }
241 device:device];
242
243 LandscapeRightOnly* delegate4 = [[LandscapeRightOnly alloc] init];
244 [self orientationHelper:delegate4 expectedImageNameDictionary:@{
245 @"landscapeLeft" : @"Default",
246 @"landscapeRight" : @"Default",
247 @"portrait" : @"Default",
248 @"portraitUpsideDown" : @"Default"
249 }
250 device:device];
251
252 // All Portrait
253
254 AllPortraitOnly* delegate5 = [[AllPortraitOnly alloc] init];
255 [self orientationHelper:delegate5 expectedImageNameDictionary:@{
256 @"landscapeLeft" : @"Default",
257 @"landscapeRight" : @"Default",
258 @"portrait" : @"Default",
259 @"portraitUpsideDown" : @"Default"
260 }
261 device:device];
262
263 // All Landscape
264
265 AllLandscapeOnly* delegate6 = [[AllLandscapeOnly alloc] init];
266 [self orientationHelper:delegate6 expectedImageNameDictionary:@{
267 @"landscapeLeft" : @"Default",
268 @"landscapeRight" : @"Default",
269 @"portrait" : @"Default",
270 @"portraitUpsideDown" : @"Default"
271 }
272 device:device];
273
274
275 // All orientations
276
277 AllOrientations* delegate7 = [[AllOrientations alloc] init];
278 [self orientationHelper:delegate7 expectedImageNameDictionary:@{
279 @"landscapeLeft" : @"Default",
280 @"landscapeRight" : @"Default",
281 @"portrait" : @"Default",
282 @"portraitUpsideDown" : @"Default"
283 }
284 device:device];
285
286 // Portrait and Landscape Left
287
288 PortraitAndLandscapeLeftOnly* delegate8 = [[PortraitAndLandscapeLeftOnly alloc] init];
289 [self orientationHelper:delegate8 expectedImageNameDictionary:@{
290 @"landscapeLeft" : @"Default",
291 @"landscapeRight" : @"Default",
292 @"portrait" : @"Default",
293 @"portraitUpsideDown" : @"Default"
294 }
295 device:device];
296
297 // Portrait and Landscape Right
298
299 PortraitAndLandscapeRightOnly* delegate9 = [[PortraitAndLandscapeRightOnly alloc] init];
300 [self orientationHelper:delegate9 expectedImageNameDictionary:@{
301 @"landscapeLeft" : @"Default",
302 @"landscapeRight" : @"Default",
303 @"portrait" : @"Default",
304 @"portraitUpsideDown" : @"Default"
305 }
306 device:device];
307
308 // PortraitUpsideDown and Landscape Left
309
310 PortraitUpsideDownAndLandscapeLeftOnly* delegate10 = [[PortraitUpsideDownAndLandscapeLeftOnly alloc] init];
311 [self orientationHelper:delegate10 expectedImageNameDictionary:@{
312 @"landscapeLeft" : @"Default",
313 @"landscapeRight" : @"Default",
314 @"portrait" : @"Default",
315 @"portraitUpsideDown" : @"Default"
316 }
317 device:device];
318
319 // PortraitUpsideDown and Landscape Right
320
321 PortraitUpsideDownAndLandscapeRightOnly* delegate11 = [[PortraitUpsideDownAndLandscapeRightOnly alloc] init];
322 [self orientationHelper:delegate11 expectedImageNameDictionary:@{
323 @"landscapeLeft" : @"Default",
324 @"landscapeRight" : @"Default",
325 @"portrait" : @"Default",
326 @"portraitUpsideDown" : @"Default"
327 }
328 device:device];
329}
330
331- (void)testiPhone5Orientation {
332
333 CDV_iOSDevice device = CDV_iOSDeviceZero;
334 device.iPhone = YES;
335 device.iPhone5 = YES;
336
337 // One orientation
338
339 PortraitOnly* delegate = [[PortraitOnly alloc] init];
340 [self orientationHelper:delegate expectedImageNameDictionary:@{
341 @"landscapeLeft" : @"Default-568h",
342 @"landscapeRight" : @"Default-568h",
343 @"portrait" : @"Default-568h",
344 @"portraitUpsideDown" : @"Default-568h"
345 }
346 device:device];
347
348 PortraitUpsideDownOnly* delegate2 = [[PortraitUpsideDownOnly alloc] init];
349 [self orientationHelper:delegate2 expectedImageNameDictionary:@{
350 @"landscapeLeft" : @"Default-568h",
351 @"landscapeRight" : @"Default-568h",
352 @"portrait" : @"Default-568h",
353 @"portraitUpsideDown" : @"Default-568h"
354 }
355 device:device];
356
357 LandscapeLeftOnly* delegate3 = [[LandscapeLeftOnly alloc] init];
358 [self orientationHelper:delegate3 expectedImageNameDictionary:@{
359 @"landscapeLeft" : @"Default-568h",
360 @"landscapeRight" : @"Default-568h",
361 @"portrait" : @"Default-568h",
362 @"portraitUpsideDown" : @"Default-568h"
363 }
364 device:device];
365
366 LandscapeRightOnly* delegate4 = [[LandscapeRightOnly alloc] init];
367 [self orientationHelper:delegate4 expectedImageNameDictionary:@{
368 @"landscapeLeft" : @"Default-568h",
369 @"landscapeRight" : @"Default-568h",
370 @"portrait" : @"Default-568h",
371 @"portraitUpsideDown" : @"Default-568h"
372 }
373 device:device];
374
375 // All Portrait
376
377 AllPortraitOnly* delegate5 = [[AllPortraitOnly alloc] init];
378 [self orientationHelper:delegate5 expectedImageNameDictionary:@{
379 @"landscapeLeft" : @"Default-568h",
380 @"landscapeRight" : @"Default-568h",
381 @"portrait" : @"Default-568h",
382 @"portraitUpsideDown" : @"Default-568h"
383 }
384 device:device];
385
386 // All Landscape
387
388 AllLandscapeOnly* delegate6 = [[AllLandscapeOnly alloc] init];
389 [self orientationHelper:delegate6 expectedImageNameDictionary:@{
390 @"landscapeLeft" : @"Default-568h",
391 @"landscapeRight" : @"Default-568h",
392 @"portrait" : @"Default-568h",
393 @"portraitUpsideDown" : @"Default-568h"
394 }
395 device:device];
396
397
398 // All orientations
399
400 AllOrientations* delegate7 = [[AllOrientations alloc] init];
401 [self orientationHelper:delegate7 expectedImageNameDictionary:@{
402 @"landscapeLeft" : @"Default-568h",
403 @"landscapeRight" : @"Default-568h",
404 @"portrait" : @"Default-568h",
405 @"portraitUpsideDown" : @"Default-568h"
406 }
407 device:device];
408
409 // Portrait and Landscape Left
410
411 PortraitAndLandscapeLeftOnly* delegate8 = [[PortraitAndLandscapeLeftOnly alloc] init];
412 [self orientationHelper:delegate8 expectedImageNameDictionary:@{
413 @"landscapeLeft" : @"Default-568h",
414 @"landscapeRight" : @"Default-568h",
415 @"portrait" : @"Default-568h",
416 @"portraitUpsideDown" : @"Default-568h"
417 }
418 device:device];
419
420 // Portrait and Landscape Right
421
422 PortraitAndLandscapeRightOnly* delegate9 = [[PortraitAndLandscapeRightOnly alloc] init];
423 [self orientationHelper:delegate9 expectedImageNameDictionary:@{
424 @"landscapeLeft" : @"Default-568h",
425 @"landscapeRight" : @"Default-568h",
426 @"portrait" : @"Default-568h",
427 @"portraitUpsideDown" : @"Default-568h"
428 }
429 device:device];
430
431 // PortraitUpsideDown and Landscape Left
432
433 PortraitUpsideDownAndLandscapeLeftOnly* delegate10 = [[PortraitUpsideDownAndLandscapeLeftOnly alloc] init];
434 [self orientationHelper:delegate10 expectedImageNameDictionary:@{
435 @"landscapeLeft" : @"Default-568h",
436 @"landscapeRight" : @"Default-568h",
437 @"portrait" : @"Default-568h",
438 @"portraitUpsideDown" : @"Default-568h"
439 }
440 device:device];
441
442 // PortraitUpsideDown and Landscape Right
443
444 PortraitUpsideDownAndLandscapeRightOnly* delegate11 = [[PortraitUpsideDownAndLandscapeRightOnly alloc] init];
445 [self orientationHelper:delegate11 expectedImageNameDictionary:@{
446 @"landscapeLeft" : @"Default-568h",
447 @"landscapeRight" : @"Default-568h",
448 @"portrait" : @"Default-568h",
449 @"portraitUpsideDown" : @"Default-568h"
450 }
451 device:device];
452}
453
454- (void)testiPhone6Orientation {
455
456 CDV_iOSDevice device = CDV_iOSDeviceZero;
457 device.iPhone = YES;
458 device.iPhone6 = YES;
459
460 // One orientation
461
462 PortraitOnly* delegate = [[PortraitOnly alloc] init];
463 [self orientationHelper:delegate expectedImageNameDictionary:@{
464 @"landscapeLeft" : @"Default-667h",
465 @"landscapeRight" : @"Default-667h",
466 @"portrait" : @"Default-667h",
467 @"portraitUpsideDown" : @"Default-667h"
468 }
469 device:device];
470
471 PortraitUpsideDownOnly* delegate2 = [[PortraitUpsideDownOnly alloc] init];
472 [self orientationHelper:delegate2 expectedImageNameDictionary:@{
473 @"landscapeLeft" : @"Default-667h",
474 @"landscapeRight" : @"Default-667h",
475 @"portrait" : @"Default-667h",
476 @"portraitUpsideDown" : @"Default-667h"
477 }
478 device:device];
479
480 LandscapeLeftOnly* delegate3 = [[LandscapeLeftOnly alloc] init];
481 [self orientationHelper:delegate3 expectedImageNameDictionary:@{
482 @"landscapeLeft" : @"Default-667h",
483 @"landscapeRight" : @"Default-667h",
484 @"portrait" : @"Default-667h",
485 @"portraitUpsideDown" : @"Default-667h"
486 }
487 device:device];
488
489 LandscapeRightOnly* delegate4 = [[LandscapeRightOnly alloc] init];
490 [self orientationHelper:delegate4 expectedImageNameDictionary:@{
491 @"landscapeLeft" : @"Default-667h",
492 @"landscapeRight" : @"Default-667h",
493 @"portrait" : @"Default-667h",
494 @"portraitUpsideDown" : @"Default-667h"
495 }
496 device:device];
497
498 // All Portrait
499
500 AllPortraitOnly* delegate5 = [[AllPortraitOnly alloc] init];
501 [self orientationHelper:delegate5 expectedImageNameDictionary:@{
502 @"landscapeLeft" : @"Default-667h",
503 @"landscapeRight" : @"Default-667h",
504 @"portrait" : @"Default-667h",
505 @"portraitUpsideDown" : @"Default-667h"
506 }
507 device:device];
508
509 // All Landscape
510
511 AllLandscapeOnly* delegate6 = [[AllLandscapeOnly alloc] init];
512 [self orientationHelper:delegate6 expectedImageNameDictionary:@{
513 @"landscapeLeft" : @"Default-667h",
514 @"landscapeRight" : @"Default-667h",
515 @"portrait" : @"Default-667h",
516 @"portraitUpsideDown" : @"Default-667h"
517 }
518 device:device];
519
520
521 // All orientations
522
523 AllOrientations* delegate7 = [[AllOrientations alloc] init];
524 [self orientationHelper:delegate7 expectedImageNameDictionary:@{
525 @"landscapeLeft" : @"Default-667h",
526 @"landscapeRight" : @"Default-667h",
527 @"portrait" : @"Default-667h",
528 @"portraitUpsideDown" : @"Default-667h"
529 }
530 device:device];
531
532 // Portrait and Landscape Left
533
534 PortraitAndLandscapeLeftOnly* delegate8 = [[PortraitAndLandscapeLeftOnly alloc] init];
535 [self orientationHelper:delegate8 expectedImageNameDictionary:@{
536 @"landscapeLeft" : @"Default-667h",
537 @"landscapeRight" : @"Default-667h",
538 @"portrait" : @"Default-667h",
539 @"portraitUpsideDown" : @"Default-667h"
540 }
541 device:device];
542
543 // Portrait and Landscape Right
544
545 PortraitAndLandscapeRightOnly* delegate9 = [[PortraitAndLandscapeRightOnly alloc] init];
546 [self orientationHelper:delegate9 expectedImageNameDictionary:@{
547 @"landscapeLeft" : @"Default-667h",
548 @"landscapeRight" : @"Default-667h",
549 @"portrait" : @"Default-667h",
550 @"portraitUpsideDown" : @"Default-667h"
551 }
552 device:device];
553
554 // PortraitUpsideDown and Landscape Left
555
556 PortraitUpsideDownAndLandscapeLeftOnly* delegate10 = [[PortraitUpsideDownAndLandscapeLeftOnly alloc] init];
557 [self orientationHelper:delegate10 expectedImageNameDictionary:@{
558 @"landscapeLeft" : @"Default-667h",
559 @"landscapeRight" : @"Default-667h",
560 @"portrait" : @"Default-667h",
561 @"portraitUpsideDown" : @"Default-667h"
562 }
563 device:device];
564
565 // PortraitUpsideDown and Landscape Right
566
567 PortraitUpsideDownAndLandscapeRightOnly* delegate11 = [[PortraitUpsideDownAndLandscapeRightOnly alloc] init];
568 [self orientationHelper:delegate11 expectedImageNameDictionary:@{
569 @"landscapeLeft" : @"Default-667h",
570 @"landscapeRight" : @"Default-667h",
571 @"portrait" : @"Default-667h",
572 @"portraitUpsideDown" : @"Default-667h"
573 }
574 device:device];
575}
576
577- (void)testiPhone6PlusOrientation {
578
579 CDV_iOSDevice device = CDV_iOSDeviceZero;
580 device.iPhone = YES;
581 device.iPhone6Plus = YES;
582
583 // One orientation
584
585 PortraitOnly* delegate = [[PortraitOnly alloc] init];
586 [self orientationHelper:delegate expectedImageNameDictionary:@{
587 @"landscapeLeft" : @"Default-736h",
588 @"landscapeRight" : @"Default-736h",
589 @"portrait" : @"Default-736h",
590 @"portraitUpsideDown" : @"Default-736h"
591 }
592 device:device];
593
594 PortraitUpsideDownOnly* delegate2 = [[PortraitUpsideDownOnly alloc] init];
595 [self orientationHelper:delegate2 expectedImageNameDictionary:@{
596 @"landscapeLeft" : @"Default-736h",
597 @"landscapeRight" : @"Default-736h",
598 @"portrait" : @"Default-736h",
599 @"portraitUpsideDown" : @"Default-736h"
600 }
601 device:device];
602
603 LandscapeLeftOnly* delegate3 = [[LandscapeLeftOnly alloc] init];
604 [self orientationHelper:delegate3 expectedImageNameDictionary:@{
605 @"landscapeLeft" : @"Default-Landscape-736h",
606 @"landscapeRight" : @"Default-Landscape-736h",
607 @"portrait" : @"Default-Landscape-736h",
608 @"portraitUpsideDown" : @"Default-Landscape-736h"
609 }
610 device:device];
611
612 LandscapeRightOnly* delegate4 = [[LandscapeRightOnly alloc] init];
613 [self orientationHelper:delegate4 expectedImageNameDictionary:@{
614 @"landscapeLeft" : @"Default-Landscape-736h",
615 @"landscapeRight" : @"Default-Landscape-736h",
616 @"portrait" : @"Default-Landscape-736h",
617 @"portraitUpsideDown" : @"Default-Landscape-736h"
618 }
619 device:device];
620
621 // All Portrait
622
623 AllPortraitOnly* delegate5 = [[AllPortraitOnly alloc] init];
624 [self orientationHelper:delegate5 expectedImageNameDictionary:@{
625 @"landscapeLeft" : @"Default-736h",
626 @"landscapeRight" : @"Default-736h",
627 @"portrait" : @"Default-736h",
628 @"portraitUpsideDown" : @"Default-736h"
629 }
630 device:device];
631
632 // All Landscape
633
634 AllLandscapeOnly* delegate6 = [[AllLandscapeOnly alloc] init];
635 [self orientationHelper:delegate6 expectedImageNameDictionary:@{
636 @"landscapeLeft" : @"Default-Landscape-736h",
637 @"landscapeRight" : @"Default-Landscape-736h",
638 @"portrait" : @"Default-Landscape-736h",
639 @"portraitUpsideDown" : @"Default-Landscape-736h"
640 }
641 device:device];
642
643
644 // All orientations
645
646 AllOrientations* delegate7 = [[AllOrientations alloc] init];
647 [self orientationHelper:delegate7 expectedImageNameDictionary:@{
648 @"landscapeLeft" : @"Default-Landscape-736h",
649 @"landscapeRight" : @"Default-Landscape-736h",
650 @"portrait" : @"Default-736h",
651 @"portraitUpsideDown" : @"Default-736h"
652 }
653 device:device];
654
655 // Portrait and Landscape Left
656
657 PortraitAndLandscapeLeftOnly* delegate8 = [[PortraitAndLandscapeLeftOnly alloc] init];
658 [self orientationHelper:delegate8 expectedImageNameDictionary:@{
659 @"landscapeLeft" : @"Default-Landscape-736h",
660 @"landscapeRight" : @"Default-Landscape-736h",
661 @"portrait" : @"Default-736h",
662 @"portraitUpsideDown" : @"Default-736h"
663 }
664 device:device];
665
666 // Portrait and Landscape Right
667
668 PortraitAndLandscapeRightOnly* delegate9 = [[PortraitAndLandscapeRightOnly alloc] init];
669 [self orientationHelper:delegate9 expectedImageNameDictionary:@{
670 @"landscapeLeft" : @"Default-Landscape-736h",
671 @"landscapeRight" : @"Default-Landscape-736h",
672 @"portrait" : @"Default-736h",
673 @"portraitUpsideDown" : @"Default-736h"
674 }
675 device:device];
676
677 // PortraitUpsideDown and Landscape Left
678
679 PortraitUpsideDownAndLandscapeLeftOnly* delegate10 = [[PortraitUpsideDownAndLandscapeLeftOnly alloc] init];
680 [self orientationHelper:delegate10 expectedImageNameDictionary:@{
681 @"landscapeLeft" : @"Default-Landscape-736h",
682 @"landscapeRight" : @"Default-Landscape-736h",
683 @"portrait" : @"Default-736h",
684 @"portraitUpsideDown" : @"Default-736h"
685 }
686 device:device];
687
688 // PortraitUpsideDown and Landscape Right
689
690 PortraitUpsideDownAndLandscapeRightOnly* delegate11 = [[PortraitUpsideDownAndLandscapeRightOnly alloc] init];
691 [self orientationHelper:delegate11 expectedImageNameDictionary:@{
692 @"landscapeLeft" : @"Default-Landscape-736h",
693 @"landscapeRight" : @"Default-Landscape-736h",
694 @"portrait" : @"Default-736h",
695 @"portraitUpsideDown" : @"Default-736h"
696 }
697 device:device];
698}
699
700
701
702@end