2011-02-26 13:48:31 +01:00
|
|
|
module('Placed Symbol');
|
|
|
|
|
|
|
|
test('placedSymbol bounds', function() {
|
2011-03-03 17:23:27 +00:00
|
|
|
var doc = new Document();
|
2011-02-26 13:48:31 +01:00
|
|
|
var path = new Path.Circle([50, 50], 50);
|
2011-03-06 10:58:05 +00:00
|
|
|
path.strokeWidth = 1;
|
|
|
|
path.strokeCap = 'round';
|
|
|
|
path.strokeJoin = 'round';
|
|
|
|
compareRectangles(path.strokeBounds,
|
2011-03-06 15:11:18 +00:00
|
|
|
{ x: -0.5, y: -0.5, width: 101, height: 101 },
|
2011-03-06 10:58:05 +00:00
|
|
|
'Path initial bounds.');
|
2011-02-26 13:48:31 +01: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 17:23:27 +00:00
|
|
|
compareRectangles(placedSymbol.bounds,
|
2011-02-26 13:48:31 +01:00
|
|
|
new Rectangle(-50.5, -50.5, 101, 101),
|
|
|
|
'PlacedSymbol initial bounds.');
|
|
|
|
|
|
|
|
placedSymbol.scale(0.5);
|
2011-03-03 17:23:27 +00:00
|
|
|
compareRectangles(placedSymbol.bounds,
|
2011-03-06 15:11:18 +00:00
|
|
|
{ x: -25.25, y: -25.25, width: 50.5, height: 50.5 },
|
2011-02-26 18:17:44 +01:00
|
|
|
'Bounds after scale.');
|
2011-02-26 13:48:31 +01:00
|
|
|
|
|
|
|
placedSymbol.rotate(40);
|
2011-03-03 17:23:27 +00:00
|
|
|
compareRectangles(placedSymbol.bounds,
|
2011-02-26 13:48:31 +01:00
|
|
|
{ x: -25.50049, y: -25.50049, width: 51.00098, height: 51.00098 },
|
2011-02-26 18:17:44 +01:00
|
|
|
'Bounds after rotation.');
|
2011-02-26 13:48:31 +01:00
|
|
|
});
|