ios-snapshot-test-case icon indicating copy to clipboard operation
ios-snapshot-test-case copied to clipboard

Some tests psuedo-randomly return "Images different sizes" where image size is a pixel off

Open zablaetna opened this issue 6 years ago • 1 comments

Noticing this on Xcode 10.3, I can run recordMode and then when I do the UI tests sometimes the image comparison is off by one pixel in size:

Snapshot comparison failed: Error Domain=FBSnapshotTestControllerErrorDomain Code=3 "Images different sizes" UserInfo={NSLocalizedFailureReason=referenceImage:{240, 240}, image:{240, 239}, FBDiffedImageKey=<UIImage: 0x600002bf6d10>, {80, 80}, FBReferenceImageKey=<UIImage: 0x600002b865a0>, {80, 80}, FBCapturedImageKey=<UIImage: 0x600002b9a140>, {80, 79.666666666666671}, NSLocalizedDescription=Images different sizes}

Note above the 80x80 icon is reported as 80x79.66 which makes the 240x240 @3x size become 240x239. I'm not sure why this is happening, but a month ago I noticed that views that were purposely 0.5 pixel in height (and I assumed width) got reported incorrectly, too.

Any way to avoid this?

zablaetna avatar Jan 07 '20 18:01 zablaetna

+1

appleios avatar Sep 02 '21 14:09 appleios