tests for drag distance

This commit is contained in:
Лаврёнов Антон
2014-03-11 23:14:03 +08:00
parent f3033dd173
commit d0c7aed452
5 changed files with 115 additions and 2 deletions

View File

@@ -1523,6 +1523,38 @@ suite('Node', function() {
assert.equal(Math.round(marker.getAbsolutePosition().y), Math.round(diagonal / 2), 'marker absolute position y should be about ' + Math.round(diagonal / 2) + ' but is about ' + Math.round(marker.getAbsolutePosition().y));
});
// ======================================================
test('test dragDistance', function() {
var stage = addStage();
var layer = new Kinetic.Layer();
var rect1 = new Kinetic.Rect({
x: 1,
y: 2,
width: 100,
height: 50,
fill: 'red'
});
var group = new Kinetic.Group({
dragDistance : 2
});
var rect2 = new Kinetic.Rect({
x: 3,
width: 100,
height: 50,
fill: 'red'
});
group.add(rect2);
layer.add(rect1).add(group);
stage.add(layer);
assert.equal(rect1.dragDistance(), 0);
assert.equal(group.dragDistance(), 2);
assert.equal(rect2.dragDistance(), 2);
});
// ======================================================
test('translate, rotate, scale shape', function() {
var stage = addStage();