mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-03-14 00:39:57 -04:00
Implement tests for PlacedSymbol, which fail because of lack of Item#strokeBounds and problems with PlacedSymbol#rotate.
This commit is contained in:
parent
422b8911b8
commit
fd2926bc45
3 changed files with 28 additions and 0 deletions
test
|
@ -14,9 +14,11 @@
|
|||
<script type="text/javascript" src="../src/basic/Size.js"></script>
|
||||
<script type="text/javascript" src="../src/basic/Matrix.js"></script>
|
||||
<script type="text/javascript" src="../src/document/Doc.js"></script>
|
||||
<script type="text/javascript" src="../src/document/Symbol.js"></script>
|
||||
<script type="text/javascript" src="../src/item/Item.js"></script>
|
||||
<script type="text/javascript" src="../src/item/Group.js"></script>
|
||||
<script type="text/javascript" src="../src/item/Layer.js"></script>
|
||||
<script type="text/javascript" src="../src/item/PlacedSymbol.js"></script>
|
||||
<script type="text/javascript" src="../src/item/PathStyle.js"></script>
|
||||
<script type="text/javascript" src="../src/path/Segment.js"></script>
|
||||
<script type="text/javascript" src="../src/path/PathItem.js"></script>
|
||||
|
@ -45,6 +47,7 @@
|
|||
<script type="text/javascript" src="tests/Path_Drawing_Commands.js"></script>
|
||||
<script type="text/javascript" src="tests/Path_Bounds.js"></script>
|
||||
<script type="text/javascript" src="tests/PathStyle.js"></script>
|
||||
<script type="text/javascript" src="tests/PlacedSymbol.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="qunit-header">QUnit Test Suite</h1>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
module('Path');
|
||||
|
||||
test('path.currentSegment', function() {
|
||||
var doc = new Doc();
|
||||
var path = new Path();
|
||||
path.moveTo([50, 50]);
|
||||
path.lineTo([100, 100]);
|
||||
|
|
24
test/tests/PlacedSymbol.js
Normal file
24
test/tests/PlacedSymbol.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
module('Placed Symbol');
|
||||
|
||||
test('placedSymbol bounds', function() {
|
||||
var doc = new Doc();
|
||||
var path = new Path.Circle([50, 50], 50);
|
||||
var symbol = new Symbol(path);
|
||||
var placedSymbol = new PlacedSymbol(symbol);
|
||||
|
||||
// These tests currently fail because we haven't implemented
|
||||
// Item#strokeBounds yet.
|
||||
compareRectangles(placedSymbol.bounds,
|
||||
new Rectangle(-50.5, -50.5, 101, 101),
|
||||
'PlacedSymbol initial bounds.');
|
||||
|
||||
placedSymbol.scale(0.5);
|
||||
compareRectangles(placedSymbol.bounds,
|
||||
{ x: -25.5, y: -25.5, width: 51, height: 51 },
|
||||
'Bounds after scale');
|
||||
|
||||
placedSymbol.rotate(40);
|
||||
compareRectangles(placedSymbol.bounds,
|
||||
{ x: -25.50049, y: -25.50049, width: 51.00098, height: 51.00098 },
|
||||
'Bounds after rotation');
|
||||
});
|
Loading…
Reference in a new issue