]> git.ipfire.org Git - thirdparty/Chart.js.git/commit
Introduce unit test based on image comparison (#3988)
authorSimon Brunel <simonbrunel@users.noreply.github.com>
Sun, 5 Mar 2017 16:49:12 +0000 (17:49 +0100)
committerTanner Linsley <tannerlinsley@gmail.com>
Sun, 5 Mar 2017 16:49:12 +0000 (09:49 -0700)
commit1ca0ffb5d5b6c2072176fd36fa85a58c483aa434
treef49012d8aadb7159dcbc14f9e14e9c0c03cf45a6
parentc216c0af769c9b12bad39b5b889867d7294dee07
Introduce unit test based on image comparison (#3988)

Attempt to make easier the creation of unit tests that check the drawing output. Until now, this was done by checking calls on a 'fake' context, which is hard to maintain (need to update pixel values by hands) and also not reliable when optimizing code (i.e. different calls sequence but same result).

As of now, it's possible to define 'auto' tests based on JSON/PNG fixtures: chart is generated from the JSON file and compared to the associated PNG image. The image diff is done using `pixelmatch`. As an example (and in preparation of the `filler` plugin), add auto tests for the line element `fill` options.
30 files changed:
gulpfile.js
package.json
test/fixtures/element.line/fill-line-bottom-span.json [new file with mode: 0644]
test/fixtures/element.line/fill-line-bottom-span.png [new file with mode: 0644]
test/fixtures/element.line/fill-line-bottom.json [new file with mode: 0644]
test/fixtures/element.line/fill-line-bottom.png [new file with mode: 0644]
test/fixtures/element.line/fill-line-spline-span.json [new file with mode: 0644]
test/fixtures/element.line/fill-line-spline-span.png [new file with mode: 0644]
test/fixtures/element.line/fill-line-spline.json [new file with mode: 0644]
test/fixtures/element.line/fill-line-spline.png [new file with mode: 0644]
test/fixtures/element.line/fill-line-stepped-span.json [new file with mode: 0644]
test/fixtures/element.line/fill-line-stepped-span.png [new file with mode: 0644]
test/fixtures/element.line/fill-line-stepped.json [new file with mode: 0644]
test/fixtures/element.line/fill-line-stepped.png [new file with mode: 0644]
test/fixtures/element.line/fill-line-top-span.json [new file with mode: 0644]
test/fixtures/element.line/fill-line-top-span.png [new file with mode: 0644]
test/fixtures/element.line/fill-line-top.json [new file with mode: 0644]
test/fixtures/element.line/fill-line-top.png [new file with mode: 0644]
test/fixtures/element.line/fill-line-zero-span.json [new file with mode: 0644]
test/fixtures/element.line/fill-line-zero-span.png [new file with mode: 0644]
test/fixtures/element.line/fill-line-zero.json [new file with mode: 0644]
test/fixtures/element.line/fill-line-zero.png [new file with mode: 0644]
test/fixtures/element.line/fill-radar-spline.json [new file with mode: 0644]
test/fixtures/element.line/fill-radar-spline.png [new file with mode: 0644]
test/fixtures/element.line/fill-radar-zero.json [new file with mode: 0644]
test/fixtures/element.line/fill-radar-zero.png [new file with mode: 0644]
test/jasmine.index.js
test/jasmine.matchers.js
test/jasmine.utils.js
test/specs/element.line.tests.js