Skip to content

fix(macos): fix failing ci snapshots #3

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

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open

fix(macos): fix failing ci snapshots #3

wants to merge 44 commits into from

Conversation

tillhainbach
Copy link
Owner

No description provided.

calda and others added 15 commits December 13, 2021 10:02
* Add Windows job to `ci.yml`

* Add missing newline

* Add name field to Windows job, format consistently

* Add `os(Windows)` checks

* Fix Windows tests

* Fix Windows line endings

* Use LF line endings for git checkout on Windows
* Update package name

* wip
* Added `Snapshotting.json` for `Any` value

Currently the only way to snapshot `Any` value is using `dump`. However, the format isn't always as readable as it can be.
For data that can be encoded in JSON, this new overload provides a much more readable output.

* Fixed macOS build

`.sortedKeys` is only available from `macOS 10.13`.

* Public extension
OpenGL types have been marked as deprecated starting with iOS 12, so if
you compile SnapshotTesting with a minimum OS target version of iOS 12
or higher, you get the following compiler warning:

```
SnapshotTesting/Sources/SnapshotTesting/Common/View.swift:585:31: error: 'GLKView' was deprecated in iOS 12.0: OpenGLES API deprecated. (Define GLES_SILENCE_DEPRECATION to silence these warnings)
    if let glkView = self as? GLKView {
                              ^
```

Because Swift has no mechanism to silence deprecation warnings, I
propose removing snapshotting support for `GLKView`.

Users of Snapshotting can still maintain support for snapshotting
`GLKView`s with a custom snapshot strategy.
When running with host application, rootViewController is retained by the window, and it retains the view controller we are testing (which is a child view controller). This causes a leak on the view controller we're testing.
By removing the view controller from it's parent, no one retains the view controller, fixing the leak.
valeriyvan and others added 16 commits September 21, 2022 10:07
* Add an optional perceptualPrecision parameter for image snapshot comparisons

The perceptual precision number is between 0 & 1 that gets translated to a CIE94 tolerance https://en.wikipedia.org/wiki/Color_difference

* Use CIColorThreshold and CIAreaAverage for a 70% faster image diff on iOS 14, tvOS 14, and macOS 11

* Add a unit test demonstrating the difference between pixel precision and perceptual precision

* Update the reference image for the image precision test

* Backport the threshold filter to macOS 10.13 by creating a CIImageProcessorKernel implementation

* Update Sources/SnapshotTesting/Snapshotting/UIImage.swift

* Update NSImage.swift

Co-authored-by: Stephen Celis <[email protected]>
Co-authored-by: Stephen Celis <[email protected]>
* Modernize Project

Getting the project into some modern order before next release.

* Update ci.yml

* Update ci.yml

* wip

* wip

* wip

* Update ci.yml
* Require Swift 5.5+

* wip

* wip
* Add SnapshotTestingHEIC to plugins list

* Fix README
I think it's better to be conservative, as the list of variables that can cause discrepancies is incomplete and unlikely to ever be exhaustive.

Other things that seem to cause differences are the architecture of the Mac running the simulator causing subtle "sub" pixel differences, and optical font sizing adjustments that either don't respect the `displayScale` UI trait or deliberately ignore it because it's truly driven by the device display's points per inch (a product of the display's scale and pixels per inch).

I think a broad caution is more prudent than extending the warning to include more device characteristics, as even if that list could be complete now, it would be very hard to track.
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

Successfully merging this pull request may close these issues.