mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Improve Raster comparison in compareItems test helper.
This commit is contained in:
parent
a535c106a8
commit
6bcb393232
1 changed files with 12 additions and 15 deletions
|
@ -324,21 +324,18 @@ function compareItems(item, item2, cloned, checkIdentity, dontShareProject) {
|
||||||
|
|
||||||
// Raster specific
|
// Raster specific
|
||||||
if (item instanceof Raster) {
|
if (item instanceof Raster) {
|
||||||
// TODO: remove access of private fields:
|
equals(item.size.toString(), item2.size.toString(),
|
||||||
if (item._canvas) {
|
'Compare Raster#size');
|
||||||
if (checkIdentity) {
|
compareNumbers(item.width, item2.width, 'Compare Raster#width');
|
||||||
equals(function() {
|
compareNumbers(item.height, item2.height, 'Compare Raster#height');
|
||||||
return item._canvas !== item2._canvas;
|
compareNumbers(item.ppi, item2.ppi, 'Compare Raster#ppi');
|
||||||
}, true);
|
equals(item.source, item2.source, 'Compare Raster#source');
|
||||||
}
|
if (checkIdentity) {
|
||||||
|
equals(item.image, item2.image, 'Compare Raster#image');
|
||||||
}
|
}
|
||||||
if (item._image) {
|
equals(item.size.toString(), item2.size.toString(),
|
||||||
equals(function() {
|
'Compare Raster#size');
|
||||||
return item._image == item2._image;
|
equals(item.toDataURL() == item2.toDataURL(), true, 'Compare Raster#toDataUrl()')
|
||||||
}, true);
|
|
||||||
}
|
|
||||||
equals(item._size.toString(), item2._size.toString(),
|
|
||||||
'Compare Item#size');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TextItem specific:
|
// TextItem specific:
|
||||||
|
@ -402,7 +399,7 @@ function testExportImportJson(project) {
|
||||||
var project2 = new Project();
|
var project2 = new Project();
|
||||||
project2.activeLayer.remove();
|
project2.activeLayer.remove();
|
||||||
project2.importJson(json);
|
project2.importJson(json);
|
||||||
compareProjects(project, project2);
|
compareProjects(project2, project);
|
||||||
}
|
}
|
||||||
|
|
||||||
// SVG
|
// SVG
|
||||||
|
|
Loading…
Reference in a new issue