Browse files

Documented tolerance.

  • Loading branch information...
1 parent 78b7f09 commit b8967948b288384777c02dde3434a413d26abf46 @cesutherland cesutherland committed Feb 20, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2
@@ -14,7 +14,7 @@ API
* `isImageData(object)` tests for ImageData object.
* `isImageType(object)` tests for any of the above.
* `toImageData(object)` converts image type object to a new ImageData object.
-* `equal(a, b)` tests image type objects for equality.
+* `equal(a, b, tolerance)` tests image type objects for equality; accepts tolerance in pixels.
* `diff(a, b)` performs an image diff on a and b, returning a - b.
* `noConflict()` removes imagediff from the global space for compatibility, returning imagediff.
* `imageDataToPNG(imageData, outputFile, (callback))` renders the imageData to png in outputFile, firing an optional callback upon save. (Node only)
@@ -29,7 +29,7 @@ Unit Testing Canvas
JS ImageDiff opens up the easy testing of Canvas and other image-like objects in JavaScript. js-imagediff supplies two Jasmine matchers to make this easier.
-* `toImageDiffEqual()` expect a result to equal another image type.
+* `toImageDiffEqual(expected, tolerance)` expect a result to equal another image type.
* `toBeImageData()` expect a result to be ImageData.
On failed tests, `toImageDiffEqual()` will display the expected image, the actual image and the imagediff of the two letting you easily spot mistakes.
@@ -54,6 +54,7 @@ Changelog
* Added NPM/node.js support.
* Added command line interface for `equal` and `diff` methods.
* Added `imageDataToPNG` method for node environments.
+* Added tolerance to handle lossy formats and provide option for acceptable difference.
* Added optional width / height parameters to `createCanvas` for symmetry with `createImageData`.

0 comments on commit b896794

Please sign in to comment.