-
Notifications
You must be signed in to change notification settings - Fork 0
Added fixed device for snapshottesting #14
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,48 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // SnapshotHelper.swift | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // SebGreenComponents | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // |
Copilot
AI
Feb 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The device configuration for iPhone15Pro is mapped to .iPhone13Pro, which may not accurately represent the actual iPhone 15 Pro device dimensions and characteristics. Consider using a more appropriate configuration or creating a custom ViewImageConfig that matches iPhone 15 Pro specifications.
| enum SnapshotDevice: String, CaseIterable { | |
| case iPhoneSE3 = "iPhoneSE3" | |
| case iPhone15Pro = "iPhone15Pro" | |
| case iPad10th = "iPad10th" | |
| var config: ViewImageConfig { | |
| switch self { | |
| case .iPhoneSE3: | |
| return .iPhoneSe | |
| case .iPhone15Pro: | |
| return .iPhone13Pro | |
| import UIKit | |
| enum SnapshotDevice: String, CaseIterable { | |
| case iPhoneSE3 = "iPhoneSE3" | |
| case iPhone15Pro = "iPhone15Pro" | |
| case iPad10th = "iPad10th" | |
| // Custom configuration approximating iPhone 15 Pro dimensions and safe area. | |
| private static let iPhone15ProConfig = ViewImageConfig( | |
| safeArea: UIEdgeInsets(top: 59, left: 0, bottom: 34, right: 0), | |
| size: CGSize(width: 393, height: 852), | |
| traits: UITraitCollection() | |
| ) | |
| var config: ViewImageConfig { | |
| switch self { | |
| case .iPhoneSE3: | |
| return .iPhoneSe | |
| case .iPhone15Pro: | |
| return SnapshotDevice.iPhone15ProConfig |
Copilot
AI
Feb 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The iPad10th device is mapped to .iPadPro11 configuration. While this may be acceptable if the screen dimensions are similar, consider documenting why this mapping was chosen or if a more accurate configuration should be used for the 10th generation iPad.
| case .iPad10th: | |
| case .iPad10th: | |
| // Use the 11" iPad Pro snapshot configuration for the 10th generation iPad, | |
| // as SnapshotTesting does not provide a dedicated config and the screen size | |
| // is sufficiently similar for our snapshot purposes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Copilot has a point here.
Uh oh!
There was an error while loading. Please reload this page.