orta / Snapshots

An Xcode Plugin to show the state of FBSnapshot Tests.
BSD 2-Clause "Simplified" License
362 stars 29 forks source link

Feature: built-in image diffs #28

Closed johnboiles closed 8 years ago

johnboiles commented 9 years ago

It'd be great to have a built in image diff-ing tool so you can get the overlaid diff of an image in addition to the (existing) clever mouse-over reveal UI.

An easy place to start would be using the GHUnit CoreGraphics image diff-ing code I wrote a few years ago. It'd just need to be changed to use NSImage APIs instead of UIGraphics* APIs, but that should be super easy.

The fourth frame of this screenshot (from GHUnit) shows what this style diffs look like:

screenshot

The way I imagine this to work is that the 'diff' button would become a toggle button that toggles between the original mouse-over reveal UI and the image diff. Maybe we add an additional button "Open in Kaleidoscope" so Kaleidoscope fans can still get there easily.

johnboiles commented 9 years ago

Hopefully I can get some time in the next few weeks to take a stab at this.

johnboiles commented 9 years ago

Oh ha! Looks like FBSnapshotTestCase already generates the diff image, using that same code linked above from GHUnit.

https://github.com/facebook/ios-snapshot-test-case/blob/master/FBSnapshotTestCase/Categories/UIImage%2BDiff.m

So this is just a matter of swapping out the mouse-over reveal ui with the diff'd image.

orta commented 9 years ago

:+1:

daehn commented 8 years ago

I gave this a try in https://github.com/orta/Snapshots/pull/39

johnboiles commented 8 years ago

Neat! I'll give it a go