added throttling unit tests

This commit is contained in:
Eric Rowell
2012-04-28 11:41:58 -07:00
parent 3200a9063a
commit 3ac0e5592e
5 changed files with 34 additions and 16 deletions

View File

@@ -193,9 +193,7 @@ Test.prototype.tests = {
width: 578,
height: 200
});
var layer = new Kinetic.Layer({
throttle: 100
});
var layer = new Kinetic.Layer();
var rect = new Kinetic.Rect({
x: 200,
y: 100,
@@ -1227,9 +1225,7 @@ Test.prototype.tests = {
width: 578,
height: 200
});
var layer = new Kinetic.Layer({
throttle: 12
});
var layer = new Kinetic.Layer();
var circle = new Kinetic.Circle({
x: stage.getWidth() / 2,
y: stage.getHeight() / 2,

View File

@@ -543,6 +543,30 @@ Test.prototype.tests = {
// LAYERS tests
////////////////////////////////////////////////////////////////////////
'LAYERS - add layer': function(containerId) {
var stage = new Kinetic.Stage({
container: containerId,
width: 578,
height: 200
});
var layer = new Kinetic.Layer();
stage.add(layer);
},
'LAYERS - throttling': function(containerId) {
var stage = new Kinetic.Stage({
container: containerId,
width: 578,
height: 200
});
var layer = new Kinetic.Layer({
throttle: 20
});
stage.add(layer);
test(layer.getThrottle() === 20, 'throttle should be 20');
layer.setThrottle(13);
test(layer.getThrottle() === 13, 'throttle should be 13');
},
'LAYERS - add layer': function(containerId) {
var stage = new Kinetic.Stage({
container: containerId,