Fix failing SVG unit test.

This commit is contained in:
Jürg Lehni 2016-02-15 08:42:59 +01:00
parent 6f4890c63c
commit 08e51b5ca4
4 changed files with 10 additions and 9 deletions

View file

@ -69,8 +69,9 @@ var Matrix = Base.extend(/** @lends Matrix# */{
} else {
ok = false;
}
if (!ok)
if (!ok) {
throw new Error('Unsupported matrix parameters');
}
},
/**
@ -129,8 +130,7 @@ var Matrix = Base.extend(/** @lends Matrix# */{
equals: function(mx) {
return mx === this || mx && this._a === mx._a && this._b === mx._b
&& this._c === mx._c && this._d === mx._d
&& this._tx === mx._tx && this._ty === mx._ty
|| false;
&& this._tx === mx._tx && this._ty === mx._ty;
},
/**

View file

@ -405,9 +405,8 @@ new function() {
var children = this._children,
view = this.getView(),
bounds = Base.pick(options.bounds, 'view'),
matrix = Matrix.read(
[options.matrix || bounds === 'view' && view._matrix],
0, { readNull: true }),
mx = options.matrix || bounds === 'view' && view._matrix,
matrix = mx && Matrix.read([mx]),
rect = bounds === 'view'
? new Rectangle([0, 0], view.getViewSize())
: bounds === 'content'

View file

@ -471,7 +471,10 @@ var compareSVG = function(done, actual, expected, message, options) {
return item instanceof Item
? item
: typeof item === 'string'
? new Raster('data:image/svg+xml;base64,' + btoa(item))
? new Raster({
source: 'data:image/svg+xml;base64,' + btoa(item),
insert: false
})
: null;
}

View file

@ -143,7 +143,6 @@ test('Export transformed shapes', function(assert) {
fillColor: 'yellow'
});
rect.rotate(-20);
var svg = project.exportSVG({ asString: true, bounds: 'content' });
console.log(svg);
var svg = project.exportSVG({ bounds: 'content', asString: true });
compareSVG(assert.async(), svg, project.activeLayer);
});