-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add iPhone 14 Devices via new SnapshotTestingExtensions target (#241)
* Add iPhone 14 Devices * Record using Xcode 14.3.1 * Fix formatting * Introduce SnapshotTestingExtensions * Fix Package files * Improve formatting Co-authored-by: Christopher Fuller <christopher.fuller@gotinder.com> * Fix Package file * Improve implementation Co-authored-by: Christopher Fuller <christopher.fuller@gotinder.com> * Remove extra spaces Co-authored-by: Christopher Fuller <christopher.fuller@gotinder.com> * Update swift.yml * Update Makefile --------- Co-authored-by: Christopher Fuller <christopher.fuller@gotinder.com>
- Loading branch information
1 parent
b56a7ff
commit b0ad58e
Showing
497 changed files
with
1,110 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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: .unavailable), | ||
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: .unavailable), | ||
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: .unavailable), | ||
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: .unavailable), | ||
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 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 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 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 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 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.
Oops, something went wrong.