Skip to content
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

Tests fail when macOS set to Dark mode #77

Open
babbage opened this issue Mar 2, 2019 · 0 comments
Open

Tests fail when macOS set to Dark mode #77

babbage opened this issue Mar 2, 2019 · 0 comments

Comments

@babbage
Copy link
Collaborator

babbage commented Mar 2, 2019

The current tests for Dark mode settings in FBSnapshotsViewer are flawed. The test "when settings doesn't contain AppleInterfaceStyle key" always fails on a macOS Mojave machine that is in Dark mode.

This is because Dark mode is set in Apple Global Defaults. The way to override these Global Defaults normally is to set the preferred value for an app in NSUserDefaults.

This override does not work for Dark Mode, however, since Dark Mode is defined by either the key "AppleInterfaceStyle" with a value of "Dark", or the absence of the key "AppleInterfaceStyle". It is therefore not possible to override a system global default that is set to dark through NSUserDefaults, because when you remove the key "AppleInterfaceStyle" from NSUserDefaults the global value is again exposed.

I believe it would be possible to modify FBSnapshotsViewer to recognise a value of "Light" for the key "AppleInterfaceStyle" in NSUserDefaults, which would then enable a configuration of this test that could pass on a machine set to Dark Mode. This could then be overridden in test setup in order to enable both current tests to pass. However, thought I'd post this as an issue for comment before submitting/merging a pull request to do this.

@babbage babbage changed the title Tests fail on macOS when set to Dark mode Tests fail when macOS set to Dark mode Mar 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant