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

View file

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

View file

@ -471,7 +471,10 @@ var compareSVG = function(done, actual, expected, message, options) {
return item instanceof Item return item instanceof Item
? item ? item
: typeof item === 'string' : 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; : null;
} }

View file

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