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

Fix: Support for snapshot tests on Intel and M1 #1094

Merged
merged 6 commits into from Feb 14, 2022
Merged

Conversation

bstien
Copy link
Member

@bstien bstien commented Feb 11, 2022

Why?

As mentioned in the iOS meeting yesterday the snapshot tests would not run successfully on M1, since there's a small color difference between the architectures when rendering shadows and cornerRadius.

The issue is described here:
pointfreeco/swift-snapshot-testing#313
pointfreeco/swift-snapshot-testing#424

As we discussed there's an open PR that masks this issue by allowing pixels to have a slightly different value, which will work for us until we're all on M1 sometime™. Since it's not merged yet we will point to @pimms fork (thank you!) until it is or we figure out another solution.

subpixelThreshold will make sure that the color channel values (RGBA) of all pixels are within the threshold. I.e. the snapshot tests won't fail if the reference pixel is #000000FF and the produced pixel is #040404FF.

PNG issue

After setting this up yesterday some tests were still failing, and I noticed that there is a tiiiiiny difference in placement when it comes to rendering some PNG images.

Kapture.2022-02-10.at.11.59.04.mp4

I'm not sure of the reason and if this applies to all PNGs, or just those with different sizes (@1x, @2x, @3x), but I reached out to Sanjin and got an updated icon in PDF to use when we need a placeholder.

What?

Version Change

Minor. No breaking changes.

UI Changes

Old icon New icon

@bstien bstien requested review from a team, ag12 and ninarg and removed request for a team February 11, 2022 13:06
@pimms
Copy link
Contributor

pimms commented Feb 11, 2022

🙂

@bstien bstien merged commit bd39f64 into master Feb 14, 2022
@bstien bstien deleted the m1-support/snapshots branch February 14, 2022 14:11
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.

None yet

3 participants