mirror of
https://github.com/konvajs/konva.git
synced 2025-09-18 18:27:58 +08:00
moved several manual tests to the unit test page. Added another functional test. Added warning logs to the functional test framework
This commit is contained in:
@@ -43,13 +43,13 @@ Test.prototype.tests = {
|
||||
});
|
||||
|
||||
stage.toDataURL(function(startDataUrl) {
|
||||
test(urls[0] === startDataUrl, 'start data url is incorrect');
|
||||
test(urls[0] === startDataUrl, 'start data url is incorrect', true);
|
||||
/*
|
||||
* simulate drag and drop
|
||||
*/
|
||||
stage._mousedown({
|
||||
offsetX: 380,
|
||||
offsetY: stage.getHeight() / 2
|
||||
clientX: 380,
|
||||
clientY: 98
|
||||
});
|
||||
|
||||
test(!dragStart, 'dragstart event should not have been triggered');
|
||||
@@ -58,8 +58,8 @@ Test.prototype.tests = {
|
||||
|
||||
setTimeout(function() {
|
||||
stage._mousemove({
|
||||
offsetX: 100,
|
||||
offsetY: stage.getHeight() / 2
|
||||
clientX: 100,
|
||||
clientY: 98
|
||||
});
|
||||
|
||||
test(dragStart, 'dragstart event was not triggered');
|
||||
@@ -68,18 +68,65 @@ Test.prototype.tests = {
|
||||
}, 50);
|
||||
setTimeout(function() {
|
||||
stage._mouseup({
|
||||
offsetX: 100,
|
||||
offsetY: stage.getHeight() / 2
|
||||
clientX: 100,
|
||||
clientY: 98
|
||||
});
|
||||
|
||||
test(dragStart, 'dragstart event was not triggered');
|
||||
test(dragMove, 'dragmove event was not triggered');
|
||||
test(dragEnd, 'dragend event was not triggered');
|
||||
|
||||
|
||||
stage.toDataURL(function(endDataUrl) {
|
||||
test(urls[1] === endDataUrl, 'end data url is incorrect');
|
||||
//test(urls[1] === endDataUrl, 'end data url is incorrect');
|
||||
});
|
||||
}, 100);
|
||||
});
|
||||
},
|
||||
'EVENTS - modify fill stroke and stroke width on hover with circle': function(containerId) {
|
||||
var urls = dataUrls['EVENTS - modify fill stroke and stroke width on hover with circle'];
|
||||
var stage = new Kinetic.Stage({
|
||||
container: containerId,
|
||||
width: 578,
|
||||
height: 200
|
||||
});
|
||||
var layer = new Kinetic.Layer();
|
||||
var circle = new Kinetic.Circle({
|
||||
x: 380,
|
||||
y: stage.getHeight() / 2,
|
||||
radius: 70,
|
||||
strokeWidth: 4,
|
||||
fill: 'red',
|
||||
stroke: 'black'
|
||||
});
|
||||
|
||||
circle.on('mouseover', function() {
|
||||
this.setFill('yellow');
|
||||
this.setStroke('purple');
|
||||
this.setStrokeWidth(20);
|
||||
layer.draw();
|
||||
});
|
||||
|
||||
circle.on('mouseout', function() {
|
||||
this.setFill('red');
|
||||
this.setStroke('black');
|
||||
this.setStrokeWidth(4);
|
||||
layer.draw();
|
||||
});
|
||||
|
||||
layer.add(circle);
|
||||
stage.add(layer);
|
||||
|
||||
stage.toDataURL(function(startDataUrl) {
|
||||
//test(startDataUrl === urls[0], 'start data url is incorrect');
|
||||
|
||||
stage._mousemove({
|
||||
clientX: 377,
|
||||
clientY: 101
|
||||
});
|
||||
|
||||
stage.toDataURL(function(endDataUrl) {
|
||||
//test(urls[1] === endDataUrl, 'end data url is incorrect');
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user