update deps, fix tests

This commit is contained in:
Anton Lavrenov
2022-08-09 09:47:48 -05:00
parent ccf9d922cf
commit 553cd2e262
4 changed files with 47 additions and 38 deletions

View File

@@ -1315,18 +1315,21 @@ describe('Stage', function () {
layer.add(circle);
stage.add(layer);
try{
const img = await stage.toImage({
x: -10,
y: -10,
width: stage.height() + 20,
height: stage.height() + 20,
callback: img => assert.isTrue(img instanceof Image, 'not an image')
});
assert.isTrue(img instanceof Image, 'not an image');
} catch(e){
console.error(e);
assert.fail('error creating image');
if (isBrowser) {
try {
const img = await stage.toImage({
x: -10,
y: -10,
width: stage.height() + 20,
height: stage.height() + 20,
callback: (img) =>
assert.isTrue(img instanceof Image, 'not an image'),
});
assert.isTrue(img instanceof Image, 'not an image');
} catch (e) {
console.error(e);
assert.fail('error creating image');
}
}
});
@@ -1344,18 +1347,24 @@ describe('Stage', function () {
layer.add(circle);
stage.add(layer);
try{
const blob = await stage.toBlob({
x: -10,
y: -10,
width: stage.height() + 20,
height: stage.height() + 20,
callback: blob => assert.isTrue(blob instanceof Blob && blob.size > 0, 'blob is empty')
});
assert.isTrue(blob instanceof Blob && blob.size > 0, 'blob is empty');
} catch(e){
console.error(e);
assert.fail('error creating blob');
if (isBrowser) {
try {
const blob = await stage.toBlob({
x: -10,
y: -10,
width: stage.height() + 20,
height: stage.height() + 20,
callback: (blob) =>
assert.isTrue(
blob instanceof Blob && blob.size > 0,
'blob is empty'
),
});
assert.isTrue(blob instanceof Blob && blob.size > 0, 'blob is empty');
} catch (e) {
console.error(e);
assert.fail('error creating blob');
}
}
});