-
Notifications
You must be signed in to change notification settings - Fork 561
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
Dealing With Display Scales #128
Comments
This unfortunately appears to be a limitation of how differently-scaled simulators render things 😞. Ideally,
Really wish there were a better solution here! Maybe in the future! |
Thanks for the quick response! I just checked how we dealt with this in the FBSnapshotTestCase stone age. Would this be an option for this library, too? |
@xavierLowmiller This is definitely a problem that could have a better solution, but for now you can encode this in the assertSnapshot(matching: vc, as: .image, named: “@\(Int(UIScreen.main.scale))x”) Not ideal, but a helper in your test suite could save you the extra work each time. We’ll try to address this better in the future, though! |
Here's the radar: rdar://46554126 Thanks for your support! |
Sadly, the radar was closed with "Behaving as intended": http://openradar.appspot.com/radar?id=4941361895702528.... |
Question:
How do you deal with size classes on different devices?
Elaborate explanation:
We'd like to generate snapshots of views in different size classes.
To do this, we pass a
UITraitCollection
with different display scales to the.image
function.Consider the following test case:
This test passes on Simulators with the same display scale (say iPhone 7 -> iPhone 8), but fails when the display scale changes (iPhone 7 -> iPhone X).
Since we run the tests on our CI on multiple devices, we can't guarantee the display scale to always be the same.
Here is a diff of the screenshots of one of the failing test cases:
The text was updated successfully, but these errors were encountered: