2011-02-26 07:48:31 -05:00
|
|
|
module('Placed Symbol');
|
|
|
|
|
|
|
|
test('placedSymbol bounds', function() {
|
2011-03-03 12:23:27 -05:00
|
|
|
var doc = new Document();
|
2011-02-26 07:48:31 -05:00
|
|
|
var path = new Path.Circle([50, 50], 50);
|
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);
|
|
|
|
|
|
|
|
// These tests currently fail because we haven't implemented
|
|
|
|
// Item#strokeBounds yet.
|
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.');
|
|
|
|
|
|
|
|
placedSymbol.scale(0.5);
|
2011-03-03 12:23:27 -05:00
|
|
|
compareRectangles(placedSymbol.bounds,
|
2011-03-06 10:11:18 -05:00
|
|
|
{ x: -25.25, y: -25.25, width: 50.5, height: 50.5 },
|
2011-02-26 12:17:44 -05:00
|
|
|
'Bounds after scale.');
|
2011-02-26 07:48:31 -05:00
|
|
|
|
|
|
|
placedSymbol.rotate(40);
|
2011-03-03 12:23:27 -05:00
|
|
|
compareRectangles(placedSymbol.bounds,
|
2011-02-26 07:48:31 -05:00
|
|
|
{ x: -25.50049, y: -25.50049, width: 51.00098, height: 51.00098 },
|
2011-02-26 12:17:44 -05:00
|
|
|
'Bounds after rotation.');
|
2011-03-06 10:14:57 -05:00
|
|
|
});
|