Snap.swift icon indicating copy to clipboard operation
Snap.swift copied to clipboard

API to expect UIImage

Open ralfebert opened this issue 7 years ago • 2 comments
trafficstars

It would be awesome if there would be an API to compare an UIImage to be able to visually inspect images, for example to test rendering code without creating full views.

Something like: expect(image: UIImage)

Current workaround: expect(UIImageView(image: image))

ralfebert avatar Feb 26 '18 21:02 ralfebert

Hey @ralfebert, in which scenario you would compare against an image and not an actual view?

skyweb07 avatar Feb 27 '18 22:02 skyweb07

I have a method that generates a cgPath and I want to test it by drawing it using the UIGraphicsImageRenderer in specific configurations. And comparing images might be useful outside of view testing, like f.e. for testing a diagram renderer library that only generates images. Snap.swift does it anyway, why not offer something simple and powerful like XCTAssertEqualImage :)

ralfebert avatar Feb 28 '18 09:02 ralfebert