mirror of
https://github.com/konvajs/konva.git
synced 2025-12-29 10:04:34 +08:00
copying over chunks of code from arrays branch
This commit is contained in:
@@ -4,16 +4,8 @@ suite('Line', function() {
|
||||
var stage = addStage();
|
||||
var layer = new Kinetic.Layer();
|
||||
|
||||
var points = [{
|
||||
x: 73,
|
||||
y: 160
|
||||
}, {
|
||||
x: 340,
|
||||
y: 23
|
||||
}];
|
||||
|
||||
var line = new Kinetic.Line({
|
||||
points: points,
|
||||
points: [73,160,340,23],
|
||||
stroke: 'blue',
|
||||
strokeWidth: 20,
|
||||
lineCap: 'round',
|
||||
@@ -26,19 +18,13 @@ suite('Line', function() {
|
||||
stage.add(layer);
|
||||
|
||||
line.setPoints([1, 2, 3, 4]);
|
||||
assert.equal(line.getPoints()[0].x, 1);
|
||||
assert.equal(line.getPoints()[0], 1);
|
||||
|
||||
line.setPoints([{
|
||||
x: 5,
|
||||
y: 6
|
||||
}, {
|
||||
x: 7,
|
||||
y: 8
|
||||
}]);
|
||||
assert.equal(line.getPoints()[0].x, 5);
|
||||
line.setPoints([5,6,7,8]);
|
||||
assert.equal(line.getPoints()[0], 5);
|
||||
|
||||
line.setPoints([73, 160, 340, 23, 340, 80]);
|
||||
assert.equal(line.getPoints()[0].x, 73);
|
||||
assert.equal(line.getPoints()[0], 73);
|
||||
|
||||
assert.equal(line.getClassName(), 'Line');
|
||||
|
||||
@@ -74,8 +60,8 @@ suite('Line', function() {
|
||||
layer.add(line).add(redLine);
|
||||
stage.add(layer);
|
||||
|
||||
assert.equal(line.getPoints()[0].x, 0);
|
||||
assert.equal(redLine.getPoints()[0].x, 4);
|
||||
assert.equal(line.getPoints()[0], 0);
|
||||
assert.equal(redLine.getPoints()[0], 4);
|
||||
|
||||
});
|
||||
|
||||
@@ -122,7 +108,7 @@ suite('Line', function() {
|
||||
line.setDashArray([10, 10]);
|
||||
assert.equal(line.getDashArray().length, 2);
|
||||
|
||||
assert.equal(line.getPoints().length, 4);
|
||||
assert.equal(line.getPoints().length, 8);
|
||||
|
||||
});
|
||||
|
||||
@@ -131,16 +117,8 @@ suite('Line', function() {
|
||||
var stage = addStage();
|
||||
var layer = new Kinetic.Layer();
|
||||
|
||||
var points = [{
|
||||
x: 73,
|
||||
y: 160
|
||||
}, {
|
||||
x: 340,
|
||||
y: 23
|
||||
}];
|
||||
|
||||
var line = new Kinetic.Line({
|
||||
points: points,
|
||||
points: [73,160,340,23],
|
||||
stroke: 'blue',
|
||||
strokeWidth: 20,
|
||||
lineCap: 'round',
|
||||
|
||||
Reference in New Issue
Block a user