Have test() method automatically create and remove a Document for reach test.

This commit is contained in:
Jürg Lehni 2011-05-14 18:59:04 +01:00
parent df1c5cdcbb
commit 2a24ec66ac
12 changed files with 38 additions and 59 deletions

View file

@ -1,5 +1,4 @@
// Let's be strict // Override equals to convert functions to message and execute them as tests()
function equals(actual, expected, message) { function equals(actual, expected, message) {
if (typeof actual === 'function') { if (typeof actual === 'function') {
if (!message) { if (!message) {
@ -15,9 +14,18 @@ function equals(actual, expected, message) {
} }
actual = actual(); actual = actual();
} }
// Let's be strict
return strictEqual(actual, expected, message); return strictEqual(actual, expected, message);
} }
function test(testName, expected) {
return QUnit.test(testName, function() {
var doc = new Document();
expected();
doc.remove();
});
}
function compareNumbers(number1, number2, message) { function compareNumbers(number1, number2, message) {
if (number1 !== 0) if (number1 !== 0)
number1 = Math.round(number1 * 100) / 100; number1 = Math.round(number1 * 100) / 100;

View file

@ -1,7 +1,6 @@
module('Color'); module('Color');
test('Set named color', function() { test('Set named color', function() {
var doc = new Document();
var path = new Path(); var path = new Path();
path.fillColor = 'red'; path.fillColor = 'red';
compareRGBColors(path.fillColor, new RGBColor(1, 0, 0)); compareRGBColors(path.fillColor, new RGBColor(1, 0, 0));
@ -9,7 +8,6 @@ test('Set named color', function() {
}); });
test('Set color to hex', function() { test('Set color to hex', function() {
var doc = new Document();
var path = new Path(); var path = new Path();
path.fillColor = '#ff0000'; path.fillColor = '#ff0000';
compareRGBColors(path.fillColor, new RGBColor(1, 0, 0)); compareRGBColors(path.fillColor, new RGBColor(1, 0, 0));
@ -22,7 +20,6 @@ test('Set color to hex', function() {
}); });
test('Set color to object', function() { test('Set color to object', function() {
var doc = new Document();
var path = new Path(); var path = new Path();
path.fillColor = { red: 1, green: 0, blue: 1}; path.fillColor = { red: 1, green: 0, blue: 1};
compareRGBColors(path.fillColor, new RGBColor(1, 0, 1)); compareRGBColors(path.fillColor, new RGBColor(1, 0, 1));
@ -35,7 +32,6 @@ test('Set color to object', function() {
}); });
test('Set color to array', function() { test('Set color to array', function() {
var doc = new Document();
var path = new Path(); var path = new Path();
path.fillColor = [1, 0, 0]; path.fillColor = [1, 0, 0];
compareRGBColors(path.fillColor, new RGBColor(1, 0, 0)); compareRGBColors(path.fillColor, new RGBColor(1, 0, 0));

View file

@ -1,28 +1,25 @@
module('Group'); module('Group');
test('new Group()', function() { test('new Group()', function() {
var doc = new Document();
var group = new Group(); var group = new Group();
equals(function() { equals(function() {
return doc.activeLayer.children[0] == group; return paper.document.activeLayer.children[0] == group;
}, true); }, true);
}); });
test('new Group([item])', function() { test('new Group([item])', function() {
var doc = new Document();
var path = new Path(); var path = new Path();
var group = new Group([path]); var group = new Group([path]);
equals(function() { equals(function() {
return doc.activeLayer.children.length == 1; return paper.document.activeLayer.children.length;
}, true); }, 1);
equals(function() { equals(function() {
return group.children[0] == path; return group.children[0] == path;
}, true); }, true);
}); });
test('Group bounds', function() { test('Group bounds', function() {
var doc = new Document(); paper.document.currentStyle = {
doc.currentStyle = {
strokeWidth: 5, strokeWidth: 5,
strokeColor: 'black' strokeColor: 'black'
}; };

View file

@ -1,7 +1,7 @@
module('Item'); module('Item');
test('copyTo(document)', function() { test('copyTo(document)', function() {
var doc = new Document(); var doc = paper.document;
var path = new Path(); var path = new Path();
var secondDoc = new Document(); var secondDoc = new Document();
var copy = path.copyTo(secondDoc); var copy = path.copyTo(secondDoc);
@ -17,7 +17,7 @@ test('copyTo(document)', function() {
}); });
test('copyTo(layer)', function() { test('copyTo(layer)', function() {
var doc = new Document(); var doc = paper.document;
var path = new Path(); var path = new Path();
var layer = new Layer(); var layer = new Layer();
@ -31,19 +31,19 @@ test('copyTo(layer)', function() {
}); });
test('clone()', function() { test('clone()', function() {
var doc = new Document(); var doc = paper.document;
var path = new Path(); var path = new Path();
var copy = path.clone(); var copy = path.clone();
equals(function() { equals(function() {
return doc.activeLayer.children.length == 2; return doc.activeLayer.children.length;
}, true); }, 2);
equals(function() { equals(function() {
return path != copy; return path != copy;
}, true); }, true);
}); });
test('appendChild(item)', function() { test('appendChild(item)', function() {
var doc = new Document(); var doc = paper.document;
var path = new Path(); var path = new Path();
doc.activeLayer.appendChild(path); doc.activeLayer.appendChild(path);
equals(function() { equals(function() {
@ -52,7 +52,7 @@ test('appendChild(item)', function() {
}); });
test('item.parent / item.isChild / item.isParent', function() { test('item.parent / item.isChild / item.isParent', function() {
var doc = new Document(); var doc = paper.document;
var secondDoc = new Document(); var secondDoc = new Document();
var path = new Path(); var path = new Path();
doc.activeLayer.appendChild(path); doc.activeLayer.appendChild(path);
@ -81,7 +81,7 @@ test('item.parent / item.isChild / item.isParent', function() {
}); });
test('item.lastChild / item.firstChild', function() { test('item.lastChild / item.firstChild', function() {
var doc = new Document(); var doc = paper.document;
var path = new Path(); var path = new Path();
var secondPath = new Path(); var secondPath = new Path();
equals(function() { equals(function() {
@ -93,7 +93,7 @@ test('item.lastChild / item.firstChild', function() {
}); });
test('appendBottom(item)', function() { test('appendBottom(item)', function() {
var doc = new Document(); var doc = paper.document;
var path = new Path(); var path = new Path();
var secondPath = new Path(); var secondPath = new Path();
doc.activeLayer.appendBottom(secondPath); doc.activeLayer.appendBottom(secondPath);
@ -103,7 +103,7 @@ test('appendBottom(item)', function() {
}); });
test('moveAbove(item)', function() { test('moveAbove(item)', function() {
var doc = new Document(); var doc = paper.document;
var path = new Path(); var path = new Path();
var secondPath = new Path(); var secondPath = new Path();
path.moveAbove(secondPath); path.moveAbove(secondPath);
@ -113,7 +113,7 @@ test('moveAbove(item)', function() {
}); });
test('moveBelow(item)', function() { test('moveBelow(item)', function() {
var doc = new Document(); var doc = paper.document;
var firstPath = new Path(); var firstPath = new Path();
var secondPath = new Path(); var secondPath = new Path();
equals(function() { equals(function() {
@ -126,7 +126,7 @@ test('moveBelow(item)', function() {
}); });
test('isDescendant(item) / isAncestor(item)', function() { test('isDescendant(item) / isAncestor(item)', function() {
var doc = new Document(); var doc = paper.document;
var path = new Path(); var path = new Path();
equals(function() { equals(function() {
return path.isDescendant(doc.activeLayer); return path.isDescendant(doc.activeLayer);
@ -152,7 +152,7 @@ test('isDescendant(item) / isAncestor(item)', function() {
}); });
test('isGroupedWith', function() { test('isGroupedWith', function() {
var doc = new Document(); var doc = paper.document;
var path = new Path(); var path = new Path();
var secondPath = new Path(); var secondPath = new Path();
var group = new Group([path]); var group = new Group([path]);
@ -191,7 +191,6 @@ test('isGroupedWith', function() {
}); });
test('getPreviousSibling() / getNextSibling()', function() { test('getPreviousSibling() / getNextSibling()', function() {
var doc = new Document();
var firstPath = new Path(); var firstPath = new Path();
var secondPath = new Path(); var secondPath = new Path();
equals(function() { equals(function() {
@ -206,7 +205,6 @@ test('getPreviousSibling() / getNextSibling()', function() {
}); });
test('hidden', function() { test('hidden', function() {
var doc = new Document();
var firstPath = new Path(); var firstPath = new Path();
firstPath.visible = false; firstPath.visible = false;
equals(function() { equals(function() {
@ -215,7 +213,7 @@ test('hidden', function() {
}); });
test('reverseChildren()', function() { test('reverseChildren()', function() {
var doc = new Document(); var doc = paper.document;
var path = new Path(); var path = new Path();
var secondPath = new Path(); var secondPath = new Path();
var thirdPath = new Path(); var thirdPath = new Path();
@ -235,6 +233,7 @@ test('reverseChildren()', function() {
}); });
test('Check item#document when moving items across documents', function() { test('Check item#document when moving items across documents', function() {
var doc = paper.document;
var doc1 = new Document(); var doc1 = new Document();
var path = new Path(); var path = new Path();
var group = new Group(); var group = new Group();
@ -256,7 +255,6 @@ test('Check item#document when moving items across documents', function() {
}); });
test('group.selected', function() { test('group.selected', function() {
var doc = new Document();
var path = new Path([0, 0]); var path = new Path([0, 0]);
var path2 = new Path([0, 0]); var path2 = new Path([0, 0]);
var group = new Group([path, path2]); var group = new Group([path, path2]);

View file

@ -1,7 +1,7 @@
module('Layer'); module('Layer');
test('previousSibling / nextSibling', function() { test('previousSibling / nextSibling', function() {
var doc = new Document(); var doc = paper.document;
var firstLayer = doc.activeLayer; var firstLayer = doc.activeLayer;
var secondLayer = new Layer(); var secondLayer = new Layer();
equals(function() { equals(function() {
@ -40,7 +40,7 @@ test('previousSibling / nextSibling', function() {
}); });
test('moveAbove / moveBelow', function() { test('moveAbove / moveBelow', function() {
var doc = new Document(); var doc = paper.document;
var firstLayer = doc.activeLayer; var firstLayer = doc.activeLayer;
var secondLayer = new Layer(); var secondLayer = new Layer();
secondLayer.moveBelow(firstLayer); secondLayer.moveBelow(firstLayer);

View file

@ -1,7 +1,6 @@
module('Path'); module('Path');
test('path.join(path)', function() { test('path.join(path)', function() {
var doc = new Document();
var path = new Path(); var path = new Path();
path.add(0, 0); path.add(0, 0);
path.add(10, 0); path.add(10, 0);
@ -13,7 +12,7 @@ test('path.join(path)', function() {
path.join(path2); path.join(path2);
equals(path.segments.toString(), '{ point: { x: 0, y: 0 } },{ point: { x: 10, y: 0 } },{ point: { x: 20, y: 10 } }'); equals(path.segments.toString(), '{ point: { x: 0, y: 0 } },{ point: { x: 10, y: 0 } },{ point: { x: 20, y: 10 } }');
equals(function() { equals(function() {
return doc.activeLayer.children.length; return paper.document.activeLayer.children.length;
}, 1); }, 1);
var path = new Path(); var path = new Path();
@ -55,7 +54,6 @@ test('path.join(path)', function() {
}); });
test('path.remove()', function() { test('path.remove()', function() {
var doc = new Document();
var path = new Path(); var path = new Path();
path.add(0, 0); path.add(0, 0);
path.add(10, 0); path.add(10, 0);
@ -80,20 +78,19 @@ test('path.remove()', function() {
path.remove(); path.remove();
equals(function() { equals(function() {
return doc.activeLayer.children.length; return paper.document.activeLayer.children.length;
}, 0); }, 0);
}); });
test('Is the path deselected after setting a new list of segments?', function() { test('Is the path deselected after setting a new list of segments?', function() {
var doc = new Document();
var path = new Path([0, 0]); var path = new Path([0, 0]);
path.selected = true; path.selected = true;
equals(function() { equals(function() {
return path.selected; return path.selected;
}, true); }, true);
equals(function() { equals(function() {
return doc.selectedItems.length; return paper.document.selectedItems.length;
}, 1); }, 1);
path.segments = [[0, 10]]; path.segments = [[0, 10]];
@ -101,12 +98,11 @@ test('Is the path deselected after setting a new list of segments?', function()
return path.selected; return path.selected;
}, false); }, false);
equals(function() { equals(function() {
return doc.selectedItems.length; return paper.document.selectedItems.length;
}, 0); }, 0);
}); });
test('Path#reverse', function() { test('Path#reverse', function() {
var doc = new Document();
var path = new Path.Circle([100, 100], 30); var path = new Path.Circle([100, 100], 30);
path.reverse(); path.reverse();
equals(path.segments.toString(), '{ point: { x: 100, y: 130 }, handleIn: { x: -16.56854, y: 0 }, handleOut: { x: 16.56854, y: 0 } },{ point: { x: 130, y: 100 }, handleIn: { x: 0, y: 16.56854 }, handleOut: { x: 0, y: -16.56854 } },{ point: { x: 100, y: 70 }, handleIn: { x: 16.56854, y: 0 }, handleOut: { x: -16.56854, y: 0 } },{ point: { x: 70, y: 100 }, handleIn: { x: 0, y: -16.56854 }, handleOut: { x: 0, y: 16.56854 } }'); equals(path.segments.toString(), '{ point: { x: 100, y: 130 }, handleIn: { x: -16.56854, y: 0 }, handleOut: { x: 16.56854, y: 0 } },{ point: { x: 130, y: 100 }, handleIn: { x: 0, y: 16.56854 }, handleOut: { x: 0, y: -16.56854 } },{ point: { x: 100, y: 70 }, handleIn: { x: 16.56854, y: 0 }, handleOut: { x: -16.56854, y: 0 } },{ point: { x: 70, y: 100 }, handleIn: { x: 0, y: -16.56854 }, handleOut: { x: 0, y: 16.56854 } }');

View file

@ -1,20 +1,18 @@
module('Path Style'); module('Path Style');
test('currentStyle', function() { test('currentStyle', function() {
var doc = new Document(); paper.document.currentStyle.fillColor = 'black';
doc.currentStyle.fillColor = 'black';
var path = new Path(); var path = new Path();
compareRGBColors(path.fillColor, 'black', 'path.fillColor'); compareRGBColors(path.fillColor, 'black', 'path.fillColor');
// When changing the current style of the document, the style of // When changing the current style of the document, the style of
// paths created using document.currentStyle should not change. // paths created using document.currentStyle should not change.
doc.currentStyle.fillColor = 'red'; paper.document.currentStyle.fillColor = 'red';
compareRGBColors(path.fillColor, 'black', 'path.fillColor'); compareRGBColors(path.fillColor, 'black', 'path.fillColor');
}); });
test('setting currentStyle to an object', function() { test('setting currentStyle to an object', function() {
var doc = new Document(); paper.document.currentStyle = {
doc.currentStyle = {
fillColor: 'red', fillColor: 'red',
strokeColor: 'green' strokeColor: 'green'
}; };
@ -24,7 +22,6 @@ test('setting currentStyle to an object', function() {
}); });
test('setting path styles to an object', function() { test('setting path styles to an object', function() {
var doc = new Document();
var path = new Path(); var path = new Path();
path.style = { path.style = {
fillColor: 'red', fillColor: 'red',
@ -35,7 +32,6 @@ test('setting path styles to an object', function() {
}); });
test('setting group styles to an object', function() { test('setting group styles to an object', function() {
var doc = new Document();
var group = new Group(); var group = new Group();
var path = new Path(); var path = new Path();
group.appendTop(path); group.appendTop(path);
@ -48,7 +44,6 @@ test('setting group styles to an object', function() {
}); });
test('getting group styles', function() { test('getting group styles', function() {
var doc = new Document();
var group = new Group(); var group = new Group();
var path = new Path(); var path = new Path();
path.fillColor = 'red'; path.fillColor = 'red';
@ -72,7 +67,6 @@ test('getting group styles', function() {
}); });
test('setting group styles', function() { test('setting group styles', function() {
var doc = new Document();
var group = new Group(); var group = new Group();
var path = new Path(); var path = new Path();
path.fillColor = 'red'; path.fillColor = 'red';
@ -96,7 +90,6 @@ test('setting group styles', function() {
}); });
test('setting group styles 2', function() { test('setting group styles 2', function() {
var doc = new Document();
var group = new Group(); var group = new Group();
var path = new Path(); var path = new Path();
path.fillColor = 'red'; path.fillColor = 'red';

View file

@ -1,7 +1,6 @@
module('Path Bounds'); module('Path Bounds');
test('path.bounds', function() { test('path.bounds', function() {
var doc = new Document();
var path = new Path([ var path = new Path([
new Segment(new Point(121, 334), new Point(-19, 38), new Point(30.7666015625, -61.53369140625)), new Segment(new Point(121, 334), new Point(-19, 38), new Point(30.7666015625, -61.53369140625)),
new Segment(new Point(248, 320), new Point(-42, -74), new Point(42, 74)), new Segment(new Point(248, 320), new Point(-42, -74), new Point(42, 74)),

View file

@ -1,8 +1,6 @@
module('Path Curves'); module('Path Curves');
test('path.curves Synchronisation', function() { test('path.curves Synchronisation', function() {
var doc = new Document();
var path = new Path(); var path = new Path();
path.add(new Point(0, 100)); path.add(new Point(0, 100));

View file

@ -1,7 +1,6 @@
module('Path Length'); module('Path Length');
test('path.length', function() { test('path.length', function() {
var doc = new Document();
var path = new Path([ var path = new Path([
new Segment(new Point(121, 334), new Point(-19, 38), new Point(30.7666015625, -61.53369140625)), new Segment(new Point(121, 334), new Point(-19, 38), new Point(30.7666015625, -61.53369140625)),
new Segment(new Point(248, 320), new Point(-42, -74), new Point(42, 74)) new Segment(new Point(248, 320), new Point(-42, -74), new Point(42, 74))
@ -15,7 +14,6 @@ test('path.length', function() {
}); });
test('curve.getParameter with straight curve', function() { test('curve.getParameter with straight curve', function() {
var doc = new Document();
var path = new Path(); var path = new Path();
path.moveTo(100, 100); path.moveTo(100, 100);
path.lineTo(500, 500); path.lineTo(500, 500);

View file

@ -39,7 +39,6 @@ test('new Path.Arc(from, through, to)', function() {
}); });
test('new Path.RegularPolygon(center, numSides, radius)', function() { test('new Path.RegularPolygon(center, numSides, radius)', function() {
var doc = new Document();
var path = new Path.RegularPolygon(new Point(50, 50), 3, 10); var path = new Path.RegularPolygon(new Point(50, 50), 3, 10);
var expectedSegments = [{ point: { x: 41.33984, y: 55 } }, { point: { x: 50, y: 40 } }, { point: { x: 58.66016, y: 55 } }]; var expectedSegments = [{ point: { x: 41.33984, y: 55 } }, { point: { x: 50, y: 40 } }, { point: { x: 58.66016, y: 55 } }];
equals(path.segments.toString(), '{ point: { x: 41.33975, y: 55 } },{ point: { x: 50, y: 40 } },{ point: { x: 58.66025, y: 55 } }'); equals(path.segments.toString(), '{ point: { x: 41.33975, y: 55 } },{ point: { x: 50, y: 40 } },{ point: { x: 58.66025, y: 55 } }');
@ -50,12 +49,10 @@ test('new Path.RegularPolygon(center, numSides, radius)', function() {
}); });
test('new Path.Star(center, numSides, radius1, radius2)', function() { test('new Path.Star(center, numSides, radius1, radius2)', function() {
var doc = new Document();
var path = new Path.Star(new Point(100, 100), 10, 10, 20); var path = new Path.Star(new Point(100, 100), 10, 10, 20);
var expectedSegments = [new Segment(new Point(100, 90)), new Segment(new Point(106.18017578125, 80.97900390625)), new Segment(new Point(105.8779296875, 91.90966796875)), new Segment(new Point(116.18017578125, 88.244140625)), new Segment(new Point(109.5107421875, 96.90966796875)), new Segment(new Point(120, 100)), new Segment(new Point(109.5107421875, 103.09033203125)), new Segment(new Point(116.18017578125, 111.755859375)), new Segment(new Point(105.8779296875, 108.09033203125)), new Segment(new Point(106.18017578125, 119.02099609375)), new Segment(new Point(100, 110)), new Segment(new Point(93.81982421875, 119.02099609375)), new Segment(new Point(94.1220703125, 108.09033203125)), new Segment(new Point(83.81982421875, 111.755859375)), new Segment(new Point(90.4892578125, 103.09033203125)), new Segment(new Point(80, 100)), new Segment(new Point(90.4892578125, 96.90966796875)), new Segment(new Point(83.81982421875, 88.244140625)), new Segment(new Point(94.1220703125, 91.90966796875)), new Segment(new Point(93.81982421875, 80.97900390625))]; var expectedSegments = [new Segment(new Point(100, 90)), new Segment(new Point(106.18017578125, 80.97900390625)), new Segment(new Point(105.8779296875, 91.90966796875)), new Segment(new Point(116.18017578125, 88.244140625)), new Segment(new Point(109.5107421875, 96.90966796875)), new Segment(new Point(120, 100)), new Segment(new Point(109.5107421875, 103.09033203125)), new Segment(new Point(116.18017578125, 111.755859375)), new Segment(new Point(105.8779296875, 108.09033203125)), new Segment(new Point(106.18017578125, 119.02099609375)), new Segment(new Point(100, 110)), new Segment(new Point(93.81982421875, 119.02099609375)), new Segment(new Point(94.1220703125, 108.09033203125)), new Segment(new Point(83.81982421875, 111.755859375)), new Segment(new Point(90.4892578125, 103.09033203125)), new Segment(new Point(80, 100)), new Segment(new Point(90.4892578125, 96.90966796875)), new Segment(new Point(83.81982421875, 88.244140625)), new Segment(new Point(94.1220703125, 91.90966796875)), new Segment(new Point(93.81982421875, 80.97900390625))];
equals(path.segments.toString(), '{ point: { x: 100, y: 90 } },{ point: { x: 106.18034, y: 80.97887 } },{ point: { x: 105.87785, y: 91.90983 } },{ point: { x: 116.18034, y: 88.24429 } },{ point: { x: 109.51057, y: 96.90983 } },{ point: { x: 120, y: 100 } },{ point: { x: 109.51057, y: 103.09017 } },{ point: { x: 116.18034, y: 111.75571 } },{ point: { x: 105.87785, y: 108.09017 } },{ point: { x: 106.18034, y: 119.02113 } },{ point: { x: 100, y: 110 } },{ point: { x: 93.81966, y: 119.02113 } },{ point: { x: 94.12215, y: 108.09017 } },{ point: { x: 83.81966, y: 111.75571 } },{ point: { x: 90.48943, y: 103.09017 } },{ point: { x: 80, y: 100 } },{ point: { x: 90.48943, y: 96.90983 } },{ point: { x: 83.81966, y: 88.24429 } },{ point: { x: 94.12215, y: 91.90983 } },{ point: { x: 93.81966, y: 80.97887 } }'); equals(path.segments.toString(), '{ point: { x: 100, y: 90 } },{ point: { x: 106.18034, y: 80.97887 } },{ point: { x: 105.87785, y: 91.90983 } },{ point: { x: 116.18034, y: 88.24429 } },{ point: { x: 109.51057, y: 96.90983 } },{ point: { x: 120, y: 100 } },{ point: { x: 109.51057, y: 103.09017 } },{ point: { x: 116.18034, y: 111.75571 } },{ point: { x: 105.87785, y: 108.09017 } },{ point: { x: 106.18034, y: 119.02113 } },{ point: { x: 100, y: 110 } },{ point: { x: 93.81966, y: 119.02113 } },{ point: { x: 94.12215, y: 108.09017 } },{ point: { x: 83.81966, y: 111.75571 } },{ point: { x: 90.48943, y: 103.09017 } },{ point: { x: 80, y: 100 } },{ point: { x: 90.48943, y: 96.90983 } },{ point: { x: 83.81966, y: 88.24429 } },{ point: { x: 94.12215, y: 91.90983 } },{ point: { x: 93.81966, y: 80.97887 } }');
var doc = new Document();
var path = new Path.Star(new Point(100, 100), 5, 20, 10); var path = new Path.Star(new Point(100, 100), 5, 20, 10);
var expectedSegments = [new Segment(new Point(100, 80)), new Segment(new Point(105.8779296875, 91.90966796875)), new Segment(new Point(119.02099609375, 93.81982421875)), new Segment(new Point(109.5107421875, 103.09033203125)), new Segment(new Point(111.755859375, 116.18017578125)), new Segment(new Point(100, 110)), new Segment(new Point(88.244140625, 116.18017578125)), new Segment(new Point(90.4892578125, 103.09033203125)), new Segment(new Point(80.97900390625, 93.81982421875)), new Segment(new Point(94.1220703125, 91.90966796875))]; var expectedSegments = [new Segment(new Point(100, 80)), new Segment(new Point(105.8779296875, 91.90966796875)), new Segment(new Point(119.02099609375, 93.81982421875)), new Segment(new Point(109.5107421875, 103.09033203125)), new Segment(new Point(111.755859375, 116.18017578125)), new Segment(new Point(100, 110)), new Segment(new Point(88.244140625, 116.18017578125)), new Segment(new Point(90.4892578125, 103.09033203125)), new Segment(new Point(80.97900390625, 93.81982421875)), new Segment(new Point(94.1220703125, 91.90966796875))];
equals(path.segments.toString(), '{ point: { x: 100, y: 80 } },{ point: { x: 105.87785, y: 91.90983 } },{ point: { x: 119.02113, y: 93.81966 } },{ point: { x: 109.51057, y: 103.09017 } },{ point: { x: 111.75571, y: 116.18034 } },{ point: { x: 100, y: 110 } },{ point: { x: 88.24429, y: 116.18034 } },{ point: { x: 90.48943, y: 103.09017 } },{ point: { x: 80.97887, y: 93.81966 } },{ point: { x: 94.12215, y: 91.90983 } }'); equals(path.segments.toString(), '{ point: { x: 100, y: 80 } },{ point: { x: 105.87785, y: 91.90983 } },{ point: { x: 119.02113, y: 93.81966 } },{ point: { x: 109.51057, y: 103.09017 } },{ point: { x: 111.75571, y: 116.18034 } },{ point: { x: 100, y: 110 } },{ point: { x: 88.24429, y: 116.18034 } },{ point: { x: 90.48943, y: 103.09017 } },{ point: { x: 80.97887, y: 93.81966 } },{ point: { x: 94.12215, y: 91.90983 } }');

View file

@ -1,7 +1,6 @@
module('Placed Symbol'); module('Placed Symbol');
test('placedSymbol bounds', function() { test('placedSymbol bounds', function() {
var doc = new Document();
var path = new Path.Circle([50, 50], 50); var path = new Path.Circle([50, 50], 50);
path.strokeWidth = 1; path.strokeWidth = 1;
path.strokeCap = 'round'; path.strokeCap = 'round';