Skip to content

Commit

Permalink
fix tests!
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaMan123 committed Sep 1, 2022
1 parent 672ff98 commit 51b93a8
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions test/unit/canvas_static.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@
return _createImageObject(IMG_WIDTH, IMG_HEIGHT, callback);
}

function createImageStub() {
return new fabric.Image(_createImageElement(), { width: 0, height: 0 });
}

function setSrc(img, src, callback) {
img.onload = callback;
img.src = src;
Expand Down Expand Up @@ -878,7 +882,7 @@
text = new fabric.Text('Text'),
group = new fabric.Group([text, line]),
ellipse = new fabric.Ellipse(),
image = new fabric.Image({width: 0, height: 0}),
image = createImageStub(),
path2 = new fabric.Path('M 0 0 L 200 100 L 200 300 z'),
path3 = new fabric.Path('M 50 50 L 100 300 L 400 400 z'),
pathGroup = new fabric.Group([path2, path3]);
Expand Down Expand Up @@ -913,9 +917,9 @@
text = new fabric.Text('Text'),
group = new fabric.Group([text, line]),
ellipse = new fabric.Ellipse(),
image = new fabric.Image({width: 0, height: 0}),
imageBG = new fabric.Image({width: 0, height: 0}),
imageOL = new fabric.Image({width: 0, height: 0}),
image = createImageStub(),
imageBG = createImageStub(),
imageOL = createImageStub(),
path2 = new fabric.Path('M 0 0 L 200 100 L 200 300 z'),
path3 = new fabric.Path('M 50 50 L 100 300 L 400 400 z'),
pathGroup = new fabric.Group([path2, path3]);
Expand Down Expand Up @@ -953,7 +957,7 @@
text = new fabric.Text('Text'),
group = new fabric.Group([text, line]),
ellipse = new fabric.Ellipse(),
image = new fabric.Image({width: 0, height: 0}),
image = createImageStub(),
path2 = new fabric.Path('M 0 0 L 200 100 L 200 300 z'),
path3 = new fabric.Path('M 50 50 L 100 300 L 400 400 z'),
pathGroup = new fabric.Group([path2, path3]);
Expand Down Expand Up @@ -983,10 +987,7 @@
});

QUnit.test('toSVG with exclude from export background', function(assert) {
var image = fabric.document.createElement('img'),
imageBG = new fabric.Image(image, {width: 0, height: 0}),
imageOL = new fabric.Image(image, {width: 0, height: 0});

const imageBG = createImageStub(), imageOL = createImageStub();
canvas.renderOnAddRemove = false;
canvas.backgroundImage = imageBG;
canvas.overlayImage = imageOL;
Expand Down

0 comments on commit 51b93a8

Please sign in to comment.