You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
babbage
changed the title
Tests fail on macOS when set to Dark mode
Tests fail when macOS set to Dark mode
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.
The text was updated successfully, but these errors were encountered: