Skip to content

Commit

Permalink
Update the project to Xcode 15.4.
Browse files Browse the repository at this point in the history
  • Loading branch information
pixlwave committed Jul 15, 2024
1 parent 384d04a commit 88e35af
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:

- name: Configure Xcode 15
run: |
sudo xcode-select -s /Applications/Xcode_15.2.app
sudo xcode-select -s /Applications/Xcode_15.4.app
- name: Run tests
run: xcodebuild test -scheme 'Compound' -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 15,OS=17.2' -skipPackagePluginValidation -resultBundlePath Logs/CompoundTests.xcresult
run: xcodebuild test -scheme 'Compound' -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone SE (3rd generation),OS=17.5' -skipPackagePluginValidation -resultBundlePath Logs/CompoundTests.xcresult

- name: Zip artifacts
if: failure() # We only care about artefacts if the tests fail
Expand Down
2 changes: 1 addition & 1 deletion Tests/CompoundTests/.prefire.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
test_configuration:
- simulator_device: "iPhone15"
- simulator_device: "iPhone14,6" # iPhone SE 3rd Generation
- required_os: 17
- template_file_path: PreviewTests.stencil
- snapshot_devices:
Expand Down
19 changes: 13 additions & 6 deletions Tests/CompoundTests/PreviewTests.stencil
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ class PreviewTests: XCTestCase {
fatalError("Unknown device name: \(deviceName)")
}

// Ignore specific device safe area
device.safeArea = .zero
// Ignore specific device safe area (using the workaround value to fix rendering issues).
device.safeArea = .one

// Ignore specific device display scale
let traits = UITraitCollection(displayScale: 2.0)
Expand Down Expand Up @@ -144,7 +144,7 @@ class PreviewTests: XCTestCase {
if let simulatorDevice {
let deviceModel = ProcessInfo().environment["SIMULATOR_MODEL_IDENTIFIER"]
guard deviceModel?.contains(simulatorDevice) ?? false else {
fatalError("Switch to using \(simulatorDevice) for these tests.")
fatalError("\(deviceModel ?? "Unknown") is the wrong one. Switch to using \(simulatorDevice) for these tests.")
}
}

Expand Down Expand Up @@ -200,10 +200,11 @@ private extension Snapshotting where Value: SwiftUI.View, Format == UIImage {
config = deviceConfig
#endif
case .sizeThatFits:
config = .init(safeArea: .zero, size: nil, traits: traits)
// Make sure to use the workaround safe area insets.
config = .init(safeArea: .one, size: nil, traits: traits)
case let .fixed(width: width, height: height):
let size = CGSize(width: width, height: height)
config = .init(safeArea: .zero, size: size, traits: traits)
// Make sure to use the workaround safe area insets.
config = .init(safeArea: .one, size: size, traits: traits)
}

return SimplySnapshotting<UIImage>(pathExtension: "png", diffing: .prefireImage(precision: precision, perceptualPrecision: perceptualPrecision, scale: traits.displayScale))
Expand Down Expand Up @@ -256,3 +257,9 @@ private extension Diffing where Value == UIImage {
)
}
}

private extension UIEdgeInsets {
/// A custom inset that prevents the snapshotting library from rendering the
/// origin at (10000, 10000) which breaks some of our views such as MessageText.
static var one: UIEdgeInsets { UIEdgeInsets(top: 1, left: 1, bottom: 1, right: 1) }
}
2 changes: 1 addition & 1 deletion Tests/CompoundTests/__Snapshots__
Submodule __Snapshots__ updated 34 files
+ PreviewTests/test_compoundButtonStyle-iPad.1.png
+ PreviewTests/test_compoundButtonStyle-iPhone-15.1.png
+ PreviewTests/test_compoundIcon-iPad.Accessibility-Icons-Only.png
+ PreviewTests/test_compoundIcon-iPad.Accessibility-Labels.png
+ PreviewTests/test_compoundIcon-iPad.Buttons.png
+ PreviewTests/test_compoundIcon-iPad.Form.png
+ PreviewTests/test_compoundIcon-iPhone-15.Accessibility-Icons-Only.png
+ PreviewTests/test_compoundIcon-iPhone-15.Accessibility-Labels.png
+ PreviewTests/test_compoundIcon-iPhone-15.Buttons.png
+ PreviewTests/test_compoundIcon-iPhone-15.Form.png
+ PreviewTests/test_compoundToggleStyle-iPad.1.png
+ PreviewTests/test_compoundToggleStyle-iPhone-15.1.png
+ PreviewTests/test_listInlinePicker-iPad.1.png
+ PreviewTests/test_listInlinePicker-iPhone-15.1.png
+ PreviewTests/test_listRow-iPad.1.png
+ PreviewTests/test_listRow-iPhone-15.1.png
+ PreviewTests/test_listRowAccessory-iPad.Accessories.png
+ PreviewTests/test_listRowAccessory-iPhone-15.Accessories.png
+ PreviewTests/test_listRowButtonStyle-iPad.1.png
+ PreviewTests/test_listRowButtonStyle-iPhone-15.1.png
+ PreviewTests/test_listRowLabel-iPad.1.png
+ PreviewTests/test_listRowLabel-iPhone-15.1.png
+ PreviewTests/test_listRowLoadingSelection-iPad.1.png
+ PreviewTests/test_listRowLoadingSelection-iPhone-15.1.png
+ PreviewTests/test_listRowTrailingSection-iPad.1.png
+ PreviewTests/test_listRowTrailingSection-iPhone-15.1.png
+ PreviewTests/test_listTextStyles-iPad.Form.png
+ PreviewTests/test_listTextStyles-iPad.List.png
+ PreviewTests/test_listTextStyles-iPhone-15.Form.png
+ PreviewTests/test_listTextStyles-iPhone-15.List.png
+ PreviewTests/test_searchStyle-iPad.Form.png
+ PreviewTests/test_searchStyle-iPad.List.png
+ PreviewTests/test_searchStyle-iPhone-15.Form.png
+ PreviewTests/test_searchStyle-iPhone-15.List.png

0 comments on commit 88e35af

Please sign in to comment.