Skip to content

Commit 37f8adf

Browse files
bluecrowbarstephencelis
authored andcommitted
Add support for iPad Pro 11-inch. (#187)
1 parent 4d426f6 commit 37f8adf

File tree

7 files changed

+28
-0
lines changed

7 files changed

+28
-0
lines changed

β€ŽSources/SnapshotTesting/Common/View.swiftβ€Ž

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,19 @@ public struct ViewImageConfig {
156156
}
157157
return .init(safeArea: .init(top: 20, left: 0, bottom: 0, right: 0), size: size, traits: .iPadPro10_5)
158158
}
159+
160+
public static let iPadPro11 = ViewImageConfig.iPadPro11(.landscape)
161+
162+
public static func iPadPro11(_ orientation: Orientation) -> ViewImageConfig {
163+
let size: CGSize
164+
switch orientation {
165+
case .landscape:
166+
size = .init(width: 1194, height: 834)
167+
case .portrait:
168+
size = .init(width: 834, height: 1194)
169+
}
170+
return .init(safeArea: .init(top: 24, left: 0, bottom: 20, right: 0), size: size, traits: .iPadPro11)
171+
}
159172

160173
public static let iPadPro12_9 = ViewImageConfig.iPadPro12_9(.landscape)
161174

@@ -350,6 +363,7 @@ extension UITraitCollection {
350363

351364
public static let iPadMini = iPad
352365
public static let iPadPro10_5 = iPad
366+
public static let iPadPro11 = iPad
353367
public static let iPadPro12_9 = iPad
354368

355369
private static let iPad = UITraitCollection(

β€ŽTests/SnapshotTestingTests/SnapshotTestingTests.swiftβ€Ž

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ final class SnapshotTestingTests: SnapshotTestCase {
334334
assertSnapshot(matching: viewController, as: .image(on: .iPhoneXsMax), named: "iphone-xs-max")
335335
assertSnapshot(matching: viewController, as: .image(on: .iPadMini), named: "ipad-mini")
336336
assertSnapshot(matching: viewController, as: .image(on: .iPadPro10_5), named: "ipad-pro-10-5")
337+
assertSnapshot(matching: viewController, as: .image(on: .iPadPro11), named: "ipad-pro-11")
337338
assertSnapshot(matching: viewController, as: .image(on: .iPadPro12_9), named: "ipad-pro-12-9")
338339

339340
assertSnapshot(matching: viewController, as: .recursiveDescription(on: .iPhoneSe), named: "iphone-se")
@@ -344,6 +345,7 @@ final class SnapshotTestingTests: SnapshotTestCase {
344345
assertSnapshot(matching: viewController, as: .recursiveDescription(on: .iPhoneXsMax), named: "iphone-xs-max")
345346
assertSnapshot(matching: viewController, as: .recursiveDescription(on: .iPadMini), named: "ipad-mini")
346347
assertSnapshot(matching: viewController, as: .recursiveDescription(on: .iPadPro10_5), named: "ipad-pro-10-5")
348+
assertSnapshot(matching: viewController, as: .recursiveDescription(on: .iPadPro11), named: "ipad-pro-11")
347349
assertSnapshot(matching: viewController, as: .recursiveDescription(on: .iPadPro12_9), named: "ipad-pro-12-9")
348350

349351
assertSnapshot(matching: viewController, as: .image(on: .iPhoneSe(.portrait)), named: "iphone-se")
@@ -354,6 +356,7 @@ final class SnapshotTestingTests: SnapshotTestCase {
354356
assertSnapshot(matching: viewController, as: .image(on: .iPhoneXsMax(.portrait)), named: "iphone-xs-max")
355357
assertSnapshot(matching: viewController, as: .image(on: .iPadMini(.landscape)), named: "ipad-mini")
356358
assertSnapshot(matching: viewController, as: .image(on: .iPadPro10_5(.landscape)), named: "ipad-pro-10-5")
359+
assertSnapshot(matching: viewController, as: .image(on: .iPadPro11(.landscape)), named: "ipad-pro-11")
357360
assertSnapshot(matching: viewController, as: .image(on: .iPadPro12_9(.landscape)), named: "ipad-pro-12-9")
358361

359362
assertSnapshot(
@@ -372,6 +375,8 @@ final class SnapshotTestingTests: SnapshotTestCase {
372375
matching: viewController, as: .image(on: .iPadMini(.portrait)), named: "ipad-mini-alternative")
373376
assertSnapshot(
374377
matching: viewController, as: .image(on: .iPadPro10_5(.portrait)), named: "ipad-pro-10-5-alternative")
378+
assertSnapshot(
379+
matching: viewController, as: .image(on: .iPadPro11(.portrait)), named: "ipad-pro-11-alternative")
375380
assertSnapshot(
376381
matching: viewController, as: .image(on: .iPadPro12_9(.portrait)), named: "ipad-pro-12-9-alternative")
377382

@@ -473,6 +478,7 @@ final class SnapshotTestingTests: SnapshotTestCase {
473478
assertSnapshot(matching: viewController, as: .image(on: .iPhoneXsMax), named: "iphone-xs-max")
474479
assertSnapshot(matching: viewController, as: .image(on: .iPadMini), named: "ipad-mini")
475480
assertSnapshot(matching: viewController, as: .image(on: .iPadPro10_5), named: "ipad-pro-10-5")
481+
assertSnapshot(matching: viewController, as: .image(on: .iPadPro11), named: "ipad-pro-11")
476482
assertSnapshot(matching: viewController, as: .image(on: .iPadPro12_9), named: "ipad-pro-12-9")
477483

478484
assertSnapshot(matching: viewController, as: .image(on: .iPhoneSe(.portrait)), named: "iphone-se")
@@ -483,6 +489,7 @@ final class SnapshotTestingTests: SnapshotTestCase {
483489
assertSnapshot(matching: viewController, as: .image(on: .iPhoneXsMax(.portrait)), named: "iphone-xs-max")
484490
assertSnapshot(matching: viewController, as: .image(on: .iPadMini(.landscape)), named: "ipad-mini")
485491
assertSnapshot(matching: viewController, as: .image(on: .iPadPro10_5(.landscape)), named: "ipad-pro-10-5")
492+
assertSnapshot(matching: viewController, as: .image(on: .iPadPro11(.landscape)), named: "ipad-pro-11")
486493
assertSnapshot(matching: viewController, as: .image(on: .iPadPro12_9(.landscape)), named: "ipad-pro-12-9")
487494

488495
assertSnapshot(
@@ -501,6 +508,8 @@ final class SnapshotTestingTests: SnapshotTestCase {
501508
matching: viewController, as: .image(on: .iPadMini(.portrait)), named: "ipad-mini-alternative")
502509
assertSnapshot(
503510
matching: viewController, as: .image(on: .iPadPro10_5(.portrait)), named: "ipad-pro-10-5-alternative")
511+
assertSnapshot(
512+
matching: viewController, as: .image(on: .iPadPro11(.portrait)), named: "ipad-pro-11-alternative")
504513
assertSnapshot(
505514
matching: viewController, as: .image(on: .iPadPro12_9(.portrait)), named: "ipad-pro-12-9-alternative")
506515
}
81.9 KB
Loading
80.6 KB
Loading
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<UIView; frame = (0 0; 1194 834); autoresize = W+H; layer = <CALayer>>
2+
| <UILabel; frame = (569.5 24; 55.5 20.5); text = 'What's'; userInteractionEnabled = NO; layer = <_UILabelLayer>>
3+
| <UILabel; frame = (0 409; 25 20.5); text = 'the'; userInteractionEnabled = NO; layer = <_UILabelLayer>>
4+
| <UILabel; frame = (1155 409; 39 20.5); text = 'point'; userInteractionEnabled = NO; layer = <_UILabelLayer>>
5+
| <UILabel; frame = (593.5 796; 7.5 18); text = '?'; userInteractionEnabled = NO; layer = <_UILabelLayer>>
81.1 KB
Loading
78.7 KB
Loading

0 commit comments

Comments
Β (0)