Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

Commit

Permalink
Loosen constraints of canvas snapshot matching
Browse files Browse the repository at this point in the history
  • Loading branch information
dschreij committed Jul 12, 2018
1 parent 665d4f6 commit 9f94f2e
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/js/tests/backends/canvas.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import * as PIXI from 'pixi.js'
// Add image snapshot matcher to Jest expect function suite
const { toMatchImageSnapshot } = require('jest-image-snapshot')
expect.extend({ toMatchImageSnapshot })
const defaultSnapshotSettings = {
failureThreshold: '0.0075',
failureThresholdType: 'percent'
}

// Set up some mock functions for the runner
const mockAddMessage = jest.fn()
Expand Down Expand Up @@ -241,7 +245,7 @@ describe('Canvas', () => {

app.renderer.render(canvas._container)
const img = canvasSnapshot()
expect(img.body).toMatchImageSnapshot()
expect(img.body).toMatchImageSnapshot(defaultSnapshotSettings)
})

it('should draw arrows', () => {
Expand All @@ -268,7 +272,7 @@ describe('Canvas', () => {

app.renderer.render(canvas._container)
const img = canvasSnapshot()
expect(img.body).toMatchImageSnapshot()
expect(img.body).toMatchImageSnapshot(defaultSnapshotSettings)
})

it('should draw circles', () => {
Expand All @@ -292,7 +296,7 @@ describe('Canvas', () => {

app.renderer.render(canvas._container)
const img = canvasSnapshot()
expect(img.body).toMatchImageSnapshot()
expect(img.body).toMatchImageSnapshot(defaultSnapshotSettings)
})

it('should draw fixation dots', () => {
Expand Down Expand Up @@ -323,7 +327,7 @@ describe('Canvas', () => {

app.renderer.render(canvas._container)
const img = canvasSnapshot()
expect(img.body).toMatchImageSnapshot()
expect(img.body).toMatchImageSnapshot(defaultSnapshotSettings)
})

it('should draw ellipses', () => {
Expand All @@ -349,7 +353,7 @@ describe('Canvas', () => {

app.renderer.render(canvas._container)
const img = canvasSnapshot()
expect(img.body).toMatchImageSnapshot()
expect(img.body).toMatchImageSnapshot(defaultSnapshotSettings)
})

it('should draw rects', () => {
Expand Down Expand Up @@ -380,7 +384,7 @@ describe('Canvas', () => {

app.renderer.render(canvas._container)
const img = canvasSnapshot()
expect(img.body).toMatchImageSnapshot()
expect(img.body).toMatchImageSnapshot(defaultSnapshotSettings)
})
})

Expand Down Expand Up @@ -424,7 +428,7 @@ describe('Canvas', () => {

app.renderer.render(canvas._container)
const img = canvasSnapshot()
expect(img.body).toMatchImageSnapshot()
expect(img.body).toMatchImageSnapshot(defaultSnapshotSettings)
})

it('should draw noise patches', () => {
Expand Down

0 comments on commit 9f94f2e

Please sign in to comment.