-
Notifications
You must be signed in to change notification settings - Fork 0
Add iPhone 14 Devices via new SnapshotTestingExtensions target #241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e1b153a
Add iPhone 14 Devices
tinder-garricnahapetian 6796b95
Record using Xcode 14.3.1
tinder-garricnahapetian fabb32d
Fix formatting
tinder-garricnahapetian 264a06c
Introduce SnapshotTestingExtensions
tinder-garricnahapetian a45356b
Fix Package files
tinder-garricnahapetian e74b4eb
Improve formatting
tinder-garricnahapetian d7fcd37
Fix Package file
tinder-garricnahapetian b94fd3c
Improve implementation
tinder-garricnahapetian 1279da9
Remove extra spaces
tinder-garricnahapetian 0ecfb3e
Update swift.yml
tinder-garricnahapetian a120275
Update Makefile
tinder-garricnahapetian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
// | ||
// All Contributions by Match Group | ||
// | ||
// Copyright © 2024 Tinder (Match Group, LLC) | ||
// | ||
// Licensed under the Match Group Modified 3-Clause BSD License. | ||
// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information. | ||
// | ||
|
||
import SnapshotTesting | ||
import UIKit | ||
|
||
extension UITraitCollection { | ||
|
||
internal static func iPhone14(_ orientation: ViewImageConfig.Orientation) -> UITraitCollection { | ||
let base: [UITraitCollection] = [ | ||
UITraitCollection(forceTouchCapability: .available), | ||
tinder-garricnahapetian marked this conversation as resolved.
Show resolved
Hide resolved
|
||
UITraitCollection(layoutDirection: .leftToRight), | ||
UITraitCollection(preferredContentSizeCategory: .medium), | ||
UITraitCollection(userInterfaceIdiom: .phone) | ||
] | ||
return switch orientation { | ||
case .landscape: | ||
UITraitCollection(traitsFrom: base + [ | ||
UITraitCollection(horizontalSizeClass: .regular), | ||
UITraitCollection(verticalSizeClass: .compact) | ||
]) | ||
case .portrait: | ||
UITraitCollection(traitsFrom: base + [ | ||
UITraitCollection(horizontalSizeClass: .compact), | ||
UITraitCollection(verticalSizeClass: .regular) | ||
]) | ||
} | ||
} | ||
|
||
internal static func iPhone14Plus(_ orientation: ViewImageConfig.Orientation) -> UITraitCollection { | ||
let base: [UITraitCollection] = [ | ||
UITraitCollection(forceTouchCapability: .available), | ||
tinder-garricnahapetian marked this conversation as resolved.
Show resolved
Hide resolved
|
||
UITraitCollection(layoutDirection: .leftToRight), | ||
UITraitCollection(preferredContentSizeCategory: .medium), | ||
UITraitCollection(userInterfaceIdiom: .phone) | ||
] | ||
return switch orientation { | ||
case .landscape: | ||
UITraitCollection(traitsFrom: base + [ | ||
UITraitCollection(horizontalSizeClass: .regular), | ||
UITraitCollection(verticalSizeClass: .compact) | ||
]) | ||
case .portrait: | ||
UITraitCollection(traitsFrom: base + [ | ||
UITraitCollection(horizontalSizeClass: .compact), | ||
UITraitCollection(verticalSizeClass: .regular) | ||
]) | ||
} | ||
} | ||
|
||
internal static func iPhone14Pro(_ orientation: ViewImageConfig.Orientation) -> UITraitCollection { | ||
let base: [UITraitCollection] = [ | ||
UITraitCollection(forceTouchCapability: .available), | ||
tinder-garricnahapetian marked this conversation as resolved.
Show resolved
Hide resolved
|
||
UITraitCollection(layoutDirection: .leftToRight), | ||
UITraitCollection(preferredContentSizeCategory: .medium), | ||
UITraitCollection(userInterfaceIdiom: .phone) | ||
] | ||
return switch orientation { | ||
case .landscape: | ||
UITraitCollection(traitsFrom: base + [ | ||
UITraitCollection(horizontalSizeClass: .regular), | ||
UITraitCollection(verticalSizeClass: .compact) | ||
]) | ||
case .portrait: | ||
UITraitCollection(traitsFrom: base + [ | ||
UITraitCollection(horizontalSizeClass: .compact), | ||
UITraitCollection(verticalSizeClass: .regular) | ||
]) | ||
} | ||
} | ||
|
||
internal static func iPhone14ProMax(_ orientation: ViewImageConfig.Orientation) -> UITraitCollection { | ||
let base: [UITraitCollection] = [ | ||
UITraitCollection(forceTouchCapability: .available), | ||
tinder-garricnahapetian marked this conversation as resolved.
Show resolved
Hide resolved
|
||
UITraitCollection(layoutDirection: .leftToRight), | ||
UITraitCollection(preferredContentSizeCategory: .medium), | ||
UITraitCollection(userInterfaceIdiom: .phone) | ||
] | ||
return switch orientation { | ||
case .landscape: | ||
UITraitCollection(traitsFrom: base + [ | ||
UITraitCollection(horizontalSizeClass: .regular), | ||
UITraitCollection(verticalSizeClass: .compact) | ||
]) | ||
case .portrait: | ||
UITraitCollection(traitsFrom: base + [ | ||
UITraitCollection(horizontalSizeClass: .compact), | ||
UITraitCollection(verticalSizeClass: .regular) | ||
]) | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// | ||
// All Contributions by Match Group | ||
// | ||
// Copyright © 2024 Tinder (Match Group, LLC) | ||
// | ||
// Licensed under the Match Group Modified 3-Clause BSD License. | ||
// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information. | ||
// | ||
|
||
import SnapshotTesting | ||
import UIKit | ||
|
||
extension ViewImageConfig { | ||
|
||
public static func iPhone14(_ orientation: Orientation) -> ViewImageConfig { | ||
let safeArea: UIEdgeInsets | ||
let size: CGSize | ||
switch orientation { | ||
case .landscape: | ||
safeArea = UIEdgeInsets(top: 0, left: 47, bottom: 21, right: 47) | ||
size = CGSize(width: 844, height: 390) | ||
case .portrait: | ||
safeArea = UIEdgeInsets(top: 47, left: 0, bottom: 34, right: 0) | ||
size = CGSize(width: 390, height: 844) | ||
} | ||
return ViewImageConfig(safeArea: safeArea, size: size, traits: .iPhone14(orientation)) | ||
} | ||
|
||
public static func iPhone14Plus(_ orientation: Orientation) -> ViewImageConfig { | ||
let safeArea: UIEdgeInsets | ||
let size: CGSize | ||
switch orientation { | ||
case .landscape: | ||
safeArea = UIEdgeInsets(top: 0, left: 47, bottom: 21, right: 47) | ||
size = CGSize(width: 926, height: 428) | ||
case .portrait: | ||
safeArea = UIEdgeInsets(top: 47, left: 0, bottom: 34, right: 0) | ||
size = CGSize(width: 428, height: 926) | ||
} | ||
return ViewImageConfig(safeArea: safeArea, size: size, traits: .iPhone14Plus(orientation)) | ||
} | ||
|
||
public static func iPhone14Pro(_ orientation: Orientation) -> ViewImageConfig { | ||
let safeArea: UIEdgeInsets | ||
let size: CGSize | ||
switch orientation { | ||
case .landscape: | ||
safeArea = UIEdgeInsets(top: 0, left: 59, bottom: 21, right: 59) | ||
size = CGSize(width: 852, height: 393) | ||
case .portrait: | ||
safeArea = UIEdgeInsets(top: 59, left: 0, bottom: 34, right: 0) | ||
size = CGSize(width: 393, height: 852) | ||
} | ||
return ViewImageConfig(safeArea: safeArea, size: size, traits: .iPhone14Pro(orientation)) | ||
} | ||
|
||
public static func iPhone14ProMax(_ orientation: Orientation) -> ViewImageConfig { | ||
let safeArea: UIEdgeInsets | ||
let size: CGSize | ||
switch orientation { | ||
case .landscape: | ||
safeArea = UIEdgeInsets(top: 0, left: 59, bottom: 21, right: 59) | ||
size = CGSize(width: 932, height: 430) | ||
case .portrait: | ||
safeArea = UIEdgeInsets(top: 59, left: 0, bottom: 34, right: 0) | ||
size = CGSize(width: 430, height: 932) | ||
} | ||
return ViewImageConfig(safeArea: safeArea, size: size, traits: .iPhone14ProMax(orientation)) | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+69.4 KB
...aintTests/testConstraintsFormatsViewsMetricsOptions.iPhone-14-Plus-portrait.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions
2
...youtConstraintTests/testConstraintsFormatsViewsMetricsOptions.iPhone-14-Plus-portrait.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<View; frame = (x: 0, y: 0, width: 428, height: 926)> | ||
| <View; name = Pink; frame = (x: 10, y: 20, width: 50, height: 100)> |
Binary file added
BIN
+70 KB
...tTests/testConstraintsFormatsViewsMetricsOptions.iPhone-14-Pro-Max-portrait.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions
2
...tConstraintTests/testConstraintsFormatsViewsMetricsOptions.iPhone-14-Pro-Max-portrait.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<View; frame = (x: 0, y: 0, width: 430, height: 932)> | ||
| <View; name = Pink; frame = (x: 10, y: 20, width: 50, height: 100)> |
Binary file added
BIN
+59.7 KB
...raintTests/testConstraintsFormatsViewsMetricsOptions.iPhone-14-Pro-portrait.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions
2
...ayoutConstraintTests/testConstraintsFormatsViewsMetricsOptions.iPhone-14-Pro-portrait.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<View; frame = (x: 0, y: 0, width: 393, height: 852)> | ||
| <View; name = Pink; frame = (x: 10, y: 20, width: 50, height: 100)> |
Binary file added
BIN
+59.1 KB
...onstraintTests/testConstraintsFormatsViewsMetricsOptions.iPhone-14-portrait.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions
2
.../NSLayoutConstraintTests/testConstraintsFormatsViewsMetricsOptions.iPhone-14-portrait.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<View; frame = (x: 0, y: 0, width: 390, height: 844)> | ||
| <View; name = Pink; frame = (x: 10, y: 20, width: 50, height: 100)> |
Binary file added
BIN
+69.6 KB
...atsViewsMetricsOptions_givenRightToLeftFormatOption.iPhone-14-Plus-portrait.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions
2
...raintsFormatsViewsMetricsOptions_givenRightToLeftFormatOption.iPhone-14-Plus-portrait.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<View; frame = (x: 0, y: 0, width: 428, height: 926)> | ||
| <View; name = Pink; frame = (x: 368, y: 20, width: 50, height: 100)> |
Binary file added
BIN
+70.4 KB
...ViewsMetricsOptions_givenRightToLeftFormatOption.iPhone-14-Pro-Max-portrait.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions
2
...ntsFormatsViewsMetricsOptions_givenRightToLeftFormatOption.iPhone-14-Pro-Max-portrait.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<View; frame = (x: 0, y: 0, width: 430, height: 932)> | ||
| <View; name = Pink; frame = (x: 370, y: 20, width: 50, height: 100)> |
Binary file added
BIN
+61.2 KB
...matsViewsMetricsOptions_givenRightToLeftFormatOption.iPhone-14-Pro-portrait.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions
2
...traintsFormatsViewsMetricsOptions_givenRightToLeftFormatOption.iPhone-14-Pro-portrait.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<View; frame = (x: 0, y: 0, width: 393, height: 852)> | ||
| <View; name = Pink; frame = (x: 333, y: 20, width: 50, height: 100)> |
Binary file added
BIN
+59.4 KB
...sFormatsViewsMetricsOptions_givenRightToLeftFormatOption.iPhone-14-portrait.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions
2
...ConstraintsFormatsViewsMetricsOptions_givenRightToLeftFormatOption.iPhone-14-portrait.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<View; frame = (x: 0, y: 0, width: 390, height: 844)> | ||
| <View; name = Pink; frame = (x: 330, y: 20, width: 50, height: 100)> |
Binary file added
BIN
+75.3 KB
...Tests/testHorizontallyCenteringDocumentationExample.iPhone-14-Plus-portrait.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...outExampleTests/testHorizontallyCenteringDocumentationExample.iPhone-14-Plus-portrait.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<View; frame = (x: 0, y: 0, width: 428, height: 926)> | ||
| <View; name = Pink; frame = (x: 164, y: 413, width: 100, height: 100)> | ||
| <UILabel; frame = (320.333 453; 51.3333 20.3333); text = 'Layout'; userInteractionEnabled = NO; backgroundColor = UIExtendedGrayColorSpace 0 0; layer = <_UILabelLayer>> |
Binary file added
BIN
+75.2 KB
...ts/testHorizontallyCenteringDocumentationExample.iPhone-14-Pro-Max-portrait.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.