2011-02-26 07:48:31 -05:00
|
|
|
module('Placed Symbol');
|
|
|
|
|
|
|
|
test('placedSymbol bounds', function() {
|
|
|
|
var path = new Path.Circle([50, 50], 50);
|
2011-05-18 14:08:52 -04:00
|
|
|
path.strokeColor = 'black';
|
2011-03-06 05:58:05 -05:00
|
|
|
path.strokeWidth = 1;
|
|
|
|
path.strokeCap = 'round';
|
|
|
|
path.strokeJoin = 'round';
|
|
|
|
compareRectangles(path.strokeBounds,
|
2011-03-06 10:11:18 -05:00
|
|
|
{ x: -0.5, y: -0.5, width: 101, height: 101 },
|
2011-03-06 05:58:05 -05:00
|
|
|
'Path initial bounds.');
|
2011-02-26 07:48:31 -05:00
|
|
|
var symbol = new Symbol(path);
|
|
|
|
var placedSymbol = new PlacedSymbol(symbol);
|
2011-03-06 19:01:26 -05:00
|
|
|
|
2011-03-03 12:23:27 -05:00
|
|
|
compareRectangles(placedSymbol.bounds,
|
2011-02-26 07:48:31 -05:00
|
|
|
new Rectangle(-50.5, -50.5, 101, 101),
|
|
|
|
'PlacedSymbol initial bounds.');
|
2011-03-06 19:01:26 -05:00
|
|
|
|
2011-03-06 16:26:38 -05:00
|
|
|
placedSymbol.scale(1, 0.5);
|
2011-03-03 12:23:27 -05:00
|
|
|
compareRectangles(placedSymbol.bounds,
|
2011-03-06 16:26:38 -05:00
|
|
|
{ x: -50.5, y: -25.25, width: 101, height: 50.5 },
|
2011-02-26 12:17:44 -05:00
|
|
|
'Bounds after scale.');
|
2011-03-06 16:26:38 -05:00
|
|
|
|
2011-02-26 07:48:31 -05:00
|
|
|
placedSymbol.rotate(40);
|
2011-03-03 12:23:27 -05:00
|
|
|
compareRectangles(placedSymbol.bounds,
|
2011-03-06 16:26:38 -05:00
|
|
|
{ x: -42.04736, y: -37.91846, width: 84.09473, height: 75.83691 },
|
2011-02-26 12:17:44 -05:00
|
|
|
'Bounds after rotation.');
|
2011-03-06 10:14:57 -05:00
|
|
|
});
|