Skip to content

Commit

Permalink
Fix failing unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
lehni committed Feb 15, 2016
1 parent 08e51b5 commit 3d330da
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/svg/SvgExport.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ new function() {
? new Rectangle([0, 0], view.getViewSize())
: bounds === 'content'
? Item._getBounds(children, matrix, { stroke: true })
: Rectangle.read([bounds], 0, { readNull: true });
: Rectangle.read([bounds], 0, { readNull: true }),
attrs = {
version: '1.1',
xmlns: SvgElement.svg,
Expand Down
2 changes: 1 addition & 1 deletion test/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ var compareSVG = function(done, actual, expected, message, options) {
? item
: typeof item === 'string'
? new Raster({
source: 'data:image/svg+xml;base64,' + btoa(item),
source: 'data:image/svg+xml;base64,' + window.btoa(item),
insert: false
})
: null;
Expand Down
61 changes: 32 additions & 29 deletions test/tests/SvgExport.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,36 +113,39 @@ test('Export SVG path at precision 0', function() {
equals(path.exportSVG({ precision: 0 }).getAttribute('d'), 'M0,2l1,1');
});

test('Export transformed shapes', function(assert) {
var rect = new Shape.Rectangle({
point: [200, 100],
size: [200, 300],
fillColor: 'red'
});
rect.rotate(40);
if (!isNode) {
// JSDom does not have SVG rendering, so we can't test there.
test('Export transformed shapes', function(assert) {
var rect = new Shape.Rectangle({
point: [200, 100],
size: [200, 300],
fillColor: 'red'
});
rect.rotate(40);

var circle = new Shape.Circle({
center: [200, 300],
radius: 100,
fillColor: 'green'
});
circle.scale(0.5, 1);
circle.rotate(40);
var circle = new Shape.Circle({
center: [200, 300],
radius: 100,
fillColor: 'green'
});
circle.scale(0.5, 1);
circle.rotate(40);

var ellipse = new Shape.Ellipse({
point: [300, 300],
size: [100, 200],
fillColor: 'blue'
});
ellipse.rotate(-40);
var ellipse = new Shape.Ellipse({
point: [300, 300],
size: [100, 200],
fillColor: 'blue'
});
ellipse.rotate(-40);

var rect = new Shape.Rectangle({
point: [250, 20],
size: [200, 300],
radius: [40, 20],
fillColor: 'yellow'
var rect = new Shape.Rectangle({
point: [250, 20],
size: [200, 300],
radius: [40, 20],
fillColor: 'yellow'
});
rect.rotate(-20);
var svg = project.exportSVG({ bounds: 'content', asString: true });
compareSVG(assert.async(), svg, project.activeLayer);
});
rect.rotate(-20);
var svg = project.exportSVG({ bounds: 'content', asString: true });
compareSVG(assert.async(), svg, project.activeLayer);
});
}

0 comments on commit 3d330da

Please sign in to comment.