mirror of
https://github.com/konvajs/konva.git
synced 2025-09-18 18:27:58 +08:00
merge
This commit is contained in:
@@ -1,38 +1,45 @@
|
||||
suite('DragAndDrop', function() {
|
||||
|
||||
// ======================================================
|
||||
test('test drag and drop properties and methods', function() {
|
||||
var stage = addStage();
|
||||
var layer = new Kinetic.Layer();
|
||||
var circle = new Kinetic.Circle({
|
||||
x: stage.getWidth() / 2,
|
||||
y: stage.getHeight() / 2,
|
||||
radius: 70,
|
||||
fill: 'green',
|
||||
stroke: 'black',
|
||||
strokeWidth: 4,
|
||||
name: 'myCircle'
|
||||
});
|
||||
test('test drag and drop properties and methods', function(done) {
|
||||
var stage = addStage();
|
||||
var layer = new Kinetic.Layer();
|
||||
var circle = new Kinetic.Circle({
|
||||
x: stage.getWidth() / 2,
|
||||
y: stage.getHeight() / 2,
|
||||
radius: 70,
|
||||
fill: 'green',
|
||||
stroke: 'black',
|
||||
strokeWidth: 4,
|
||||
name: 'myCircle'
|
||||
});
|
||||
|
||||
stage.add(layer);
|
||||
layer.add(circle);
|
||||
layer.draw();
|
||||
|
||||
// test defaults
|
||||
assert.equal(circle.draggable(), false);
|
||||
setTimeout(function() {
|
||||
|
||||
//change properties
|
||||
circle.setDraggable(true);
|
||||
layer.draw();
|
||||
|
||||
// test defaults
|
||||
assert.equal(circle.draggable(), false);
|
||||
|
||||
//change properties
|
||||
circle.setDraggable(true);
|
||||
|
||||
|
||||
//circle.on('click', function(){});
|
||||
//circle.on('click', function(){});
|
||||
|
||||
layer.draw();
|
||||
layer.draw();
|
||||
|
||||
showHit(layer);
|
||||
showHit(layer);
|
||||
|
||||
// test new properties
|
||||
assert.equal(circle.getDraggable(), true);
|
||||
// test new properties
|
||||
assert.equal(circle.getDraggable(), true);
|
||||
|
||||
done();
|
||||
|
||||
}, 50);
|
||||
});
|
||||
|
||||
// ======================================================
|
||||
|
@@ -28,7 +28,7 @@ suite('Sprite', function() {
|
||||
156, 109, 70, 98,
|
||||
229, 109, 60, 98,
|
||||
287, 109, 41, 98
|
||||
]
|
||||
]
|
||||
},
|
||||
frameRate: 10,
|
||||
draggable: true,
|
||||
@@ -72,7 +72,7 @@ suite('Sprite', function() {
|
||||
};
|
||||
imageObj.src = 'assets/scorpion-sprite.png';
|
||||
});
|
||||
test('can change frame rate on fly', function(done){
|
||||
test.skip('can change frame rate on fly', function(done){
|
||||
var imageObj = new Image();
|
||||
imageObj.onload = function() {
|
||||
var stage = addStage();
|
||||
@@ -122,9 +122,6 @@ suite('Sprite', function() {
|
||||
assert.equal(sprite.frameIndex() > 2, true);
|
||||
done();
|
||||
}, 68);
|
||||
|
||||
|
||||
|
||||
};
|
||||
imageObj.src = 'assets/scorpion-sprite.png';
|
||||
});
|
||||
|
@@ -67,6 +67,7 @@ suite('Text', function(){
|
||||
fontSize: 50,
|
||||
fontFamily: 'Calibri',
|
||||
fontStyle: 'normal',
|
||||
fontVariant: 'normal',
|
||||
fill: '#888',
|
||||
stroke: '#333',
|
||||
align: 'right',
|
||||
@@ -97,6 +98,7 @@ suite('Text', function(){
|
||||
assert.equal(text.getFontSize(), 50);
|
||||
assert.equal(text.getFontFamily(), 'Calibri');
|
||||
assert.equal(text.getFontStyle(), 'normal');
|
||||
assert.equal(text.getFontVariant(), 'normal');
|
||||
assert.equal(text.getFill(), '#888');
|
||||
assert.equal(text.getStroke(), '#333');
|
||||
assert.equal(text.getAlign(), 'right');
|
||||
@@ -117,6 +119,7 @@ suite('Text', function(){
|
||||
text.setFontSize(10);
|
||||
text.setFontFamily('Arial');
|
||||
text.setFontStyle('bold');
|
||||
text.setFontVariant('small-caps');
|
||||
text.setFill('green');
|
||||
text.setStroke('yellow');
|
||||
text.setAlign('left');
|
||||
@@ -132,6 +135,7 @@ suite('Text', function(){
|
||||
assert.equal(text.getFontSize(), 10);
|
||||
assert.equal(text.getFontFamily(), 'Arial');
|
||||
assert.equal(text.getFontStyle(), 'bold');
|
||||
assert.equal(text.getFontVariant(), 'small-caps');
|
||||
assert.equal(text.getFill(), 'green');
|
||||
assert.equal(text.getStroke(), 'yellow');
|
||||
assert.equal(text.getAlign(), 'left');
|
||||
|
Reference in New Issue
Block a user