updated unit tests

This commit is contained in:
Eric Rowell
2012-07-15 00:06:35 -07:00
parent 6dc7c685f0
commit acc6b6e14e
4 changed files with 24 additions and 9 deletions

View File

@@ -3,7 +3,7 @@
* http://www.kineticjs.com/ * http://www.kineticjs.com/
* Copyright 2012, Eric Rowell * Copyright 2012, Eric Rowell
* Licensed under the MIT or GPL Version 2 licenses. * Licensed under the MIT or GPL Version 2 licenses.
* Date: Jul 14 2012 * Date: Jul 15 2012
* *
* Copyright (C) 2011 - 2012 by Eric Rowell * Copyright (C) 2011 - 2012 by Eric Rowell
* *

View File

@@ -3,7 +3,7 @@
* http://www.kineticjs.com/ * http://www.kineticjs.com/
* Copyright 2012, Eric Rowell * Copyright 2012, Eric Rowell
* Licensed under the MIT or GPL Version 2 licenses. * Licensed under the MIT or GPL Version 2 licenses.
* Date: Jul 14 2012 * Date: Jul 15 2012
* *
* Copyright (C) 2011 - 2012 by Eric Rowell * Copyright (C) 2011 - 2012 by Eric Rowell
* *

View File

@@ -206,9 +206,12 @@ Test.prototype.tests = {
var stage = new Kinetic.Stage({ var stage = new Kinetic.Stage({
container: containerId, container: containerId,
width: 578, width: 578,
height: 200 height: 200,
throttle: 999
});
var layer = new Kinetic.Layer({
throttle: 999
}); });
var layer = new Kinetic.Layer();
var circle = new Kinetic.Ellipse({ var circle = new Kinetic.Ellipse({
x: 380, x: 380,
y: stage.getHeight() / 2, y: stage.getHeight() / 2,
@@ -222,6 +225,7 @@ Test.prototype.tests = {
this.setFill('yellow'); this.setFill('yellow');
this.setStroke('purple'); this.setStroke('purple');
this.setStrokeWidth(20); this.setStrokeWidth(20);
//console.log('mouseover')
layer.draw(); layer.draw();
}); });
@@ -229,22 +233,33 @@ Test.prototype.tests = {
this.setFill('red'); this.setFill('red');
this.setStroke('black'); this.setStroke('black');
this.setStrokeWidth(4); this.setStrokeWidth(4);
//console.log('mouseout')
layer.draw(); layer.draw();
}); });
layer.add(circle); layer.add(circle);
stage.add(layer); stage.add(layer);
var startDataUrl = stage.toDataURL(); warn(stage.toDataURL() === urls[0], 'start data url is incorrect');
warn(startDataUrl === urls[0], 'start data url is incorrect');
stage._mousemove({ stage._mousemove({
clientX: 377, clientX: 377,
clientY: 101 clientY: 101
}); });
var endDataUrl = stage.toDataURL(); warn(stage.toDataURL() === urls[1], 'mid data url is incorrect');
warn(urls[1] === endDataUrl, 'end data url is incorrect');
// move mouse back out of circle
stage._mousemove({
clientX: 157,
clientY: 138
});
stage._mousemove({
clientX: 157,
clientY: 138
});
warn(stage.toDataURL() === urls[0], 'end data url is incorrect');
}, },
'EVENTS - path detection mousedown mouseup mouseover mouseout mousemove click dblclick / touchstart touchend touchmove tap dbltap': function(containerId) { 'EVENTS - path detection mousedown mouseup mouseover mouseout mousemove click dblclick / touchstart touchend touchmove tap dbltap': function(containerId) {
var stage = new Kinetic.Stage({ var stage = new Kinetic.Stage({

View File

@@ -2232,7 +2232,7 @@ Test.prototype.tests = {
}; };
imageObj.src = '../scorpion-sprite.png'; imageObj.src = '../scorpion-sprite.png';
}, },
'*Node - shape caching': function(containerId) { 'Node - shape caching': function(containerId) {
var stage = new Kinetic.Stage({ var stage = new Kinetic.Stage({
container: containerId, container: containerId,
width: 578, width: 578,