Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

iOS - forcing a UIView to have userInterfaceStyle produces strange snapshot results #247

Open
georgegillams opened this issue Mar 13, 2020 · 2 comments

Comments

@georgegillams
Copy link

georgegillams commented Mar 13, 2020

This seems to be an issue with XCTest/XCode as it happens even if I use native methods to convert a view to an image within a XCTest context, but I thought it would still be worth tracking here too, in case you have any ideas or workarounds.

Open radar bug: http://www.openradar.appspot.com/7404933

Essentially I have a test where I define two dynamic colours:

  • dynamicColor1 is green in dark mode, purple in light mode, and black in iOS < 13.0
  • dynamicColor2 is orange in dark mode, cyan in light mode, and black in iOS < 13.0

For the light mode snapshot, I simply take a screenshot of the UIView.
For the dark mode snapshot, I create a new instance of the View, set userInterfaceStyle to dark and take a screenshot of the UIView

As you can see in the test snapshots, the dynamic text colour is being correctly applied when I force userInterfaceStyle on the UIView, while the dynamic background colour is not.

image

@nscoding
Copy link
Contributor

This repository has been archived, please open this PR here: https://github.com/uber/ios-snapshot-test-case

@georgegillams
Copy link
Author

This repository has been archived, please open this PR here: https://github.com/uber/ios-snapshot-test-case

Thanks for the heads-up. New issue opened here uber/ios-snapshot-test-case#122

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants