2012-11-14 13:37:28 +08:00
|
|
|
Test.Modules.REGULAR_POLYGON = {
|
|
|
|
'add regular polygon triangle': function(containerId) {
|
|
|
|
var stage = new Kinetic.Stage({
|
|
|
|
container: containerId,
|
|
|
|
width: 578,
|
|
|
|
height: 200
|
|
|
|
});
|
|
|
|
var layer = new Kinetic.Layer();
|
|
|
|
|
2013-03-25 11:42:27 +08:00
|
|
|
var poly = new Kinetic.RegularPolygon({
|
2012-11-14 13:37:28 +08:00
|
|
|
x: 200,
|
|
|
|
y: 100,
|
|
|
|
sides: 3,
|
|
|
|
radius: 50,
|
|
|
|
fill: 'green',
|
|
|
|
stroke: 'blue',
|
|
|
|
strokeWidth: 5,
|
|
|
|
name: 'foobar',
|
|
|
|
offset: {
|
|
|
|
x: 0,
|
|
|
|
y: -50
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
layer.add(poly);
|
|
|
|
stage.add(layer);
|
2013-03-24 15:14:42 +08:00
|
|
|
|
2013-05-20 12:48:48 +08:00
|
|
|
test(poly.getClassName() === 'RegularPolygon', 'sgetClassName should be RegularPolygon');
|
2012-11-14 13:37:28 +08:00
|
|
|
|
|
|
|
},
|
|
|
|
'add regular polygon square': function(containerId) {
|
|
|
|
var stage = new Kinetic.Stage({
|
|
|
|
container: containerId,
|
|
|
|
width: 578,
|
|
|
|
height: 200
|
|
|
|
});
|
|
|
|
var layer = new Kinetic.Layer();
|
|
|
|
|
2013-03-25 11:42:27 +08:00
|
|
|
var poly = new Kinetic.RegularPolygon({
|
2012-11-14 13:37:28 +08:00
|
|
|
x: 200,
|
|
|
|
y: 100,
|
|
|
|
sides: 4,
|
|
|
|
radius: 50,
|
|
|
|
fill: 'green',
|
|
|
|
stroke: 'blue',
|
|
|
|
strokeWidth: 5,
|
|
|
|
name: 'foobar'
|
|
|
|
});
|
|
|
|
|
|
|
|
layer.add(poly);
|
|
|
|
stage.add(layer);
|
|
|
|
},
|
|
|
|
'add regular polygon pentagon': function(containerId) {
|
|
|
|
var stage = new Kinetic.Stage({
|
|
|
|
container: containerId,
|
|
|
|
width: 578,
|
|
|
|
height: 200
|
|
|
|
});
|
|
|
|
var layer = new Kinetic.Layer();
|
|
|
|
|
2013-03-25 11:42:27 +08:00
|
|
|
var poly = new Kinetic.RegularPolygon({
|
2012-11-14 13:37:28 +08:00
|
|
|
x: 200,
|
|
|
|
y: 100,
|
|
|
|
sides: 5,
|
|
|
|
radius: 50,
|
|
|
|
fill: 'green',
|
|
|
|
stroke: 'blue',
|
|
|
|
strokeWidth: 5,
|
|
|
|
name: 'foobar'
|
|
|
|
});
|
|
|
|
|
|
|
|
layer.add(poly);
|
|
|
|
stage.add(layer);
|
|
|
|
},
|
|
|
|
'add regular polygon octogon': function(containerId) {
|
|
|
|
var stage = new Kinetic.Stage({
|
|
|
|
container: containerId,
|
|
|
|
width: 578,
|
|
|
|
height: 200
|
|
|
|
});
|
|
|
|
var layer = new Kinetic.Layer();
|
|
|
|
|
2013-03-25 11:42:27 +08:00
|
|
|
var poly = new Kinetic.RegularPolygon({
|
2012-11-14 13:37:28 +08:00
|
|
|
x: 200,
|
|
|
|
y: 100,
|
|
|
|
sides: 8,
|
|
|
|
radius: 50,
|
|
|
|
fill: 'green',
|
|
|
|
stroke: 'blue',
|
|
|
|
strokeWidth: 5,
|
|
|
|
name: 'foobar'
|
|
|
|
});
|
|
|
|
|
|
|
|
layer.add(poly);
|
|
|
|
stage.add(layer);
|
|
|
|
}
|
|
|
|
};
|