mirror of
https://github.com/konvajs/konva.git
synced 2025-09-19 10:47:59 +08:00
moved TextPath, RegularPolygon, and Star shapes to the plugins directory. updated all tests
This commit is contained in:
95
tests/js/unit/plugins/regularPolygonTests.js
Normal file
95
tests/js/unit/plugins/regularPolygonTests.js
Normal file
@@ -0,0 +1,95 @@
|
||||
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();
|
||||
|
||||
var poly = new Kinetic.Plugins.RegularPolygon({
|
||||
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);
|
||||
|
||||
},
|
||||
'add regular polygon square': function(containerId) {
|
||||
var stage = new Kinetic.Stage({
|
||||
container: containerId,
|
||||
width: 578,
|
||||
height: 200
|
||||
});
|
||||
var layer = new Kinetic.Layer();
|
||||
|
||||
var poly = new Kinetic.Plugins.RegularPolygon({
|
||||
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();
|
||||
|
||||
var poly = new Kinetic.Plugins.RegularPolygon({
|
||||
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();
|
||||
|
||||
var poly = new Kinetic.Plugins.RegularPolygon({
|
||||
x: 200,
|
||||
y: 100,
|
||||
sides: 8,
|
||||
radius: 50,
|
||||
fill: 'green',
|
||||
stroke: 'blue',
|
||||
strokeWidth: 5,
|
||||
name: 'foobar'
|
||||
});
|
||||
|
||||
layer.add(poly);
|
||||
stage.add(layer);
|
||||
}
|
||||
};
|
77
tests/js/unit/plugins/starTests.js
Normal file
77
tests/js/unit/plugins/starTests.js
Normal file
@@ -0,0 +1,77 @@
|
||||
Test.Modules.STAR = {
|
||||
'add five point star': function(containerId) {
|
||||
var stage = new Kinetic.Stage({
|
||||
container: containerId,
|
||||
width: 578,
|
||||
height: 200
|
||||
});
|
||||
var layer = new Kinetic.Layer();
|
||||
|
||||
var star = new Kinetic.Plugins.Star({
|
||||
x: 200,
|
||||
y: 100,
|
||||
numPoints: 5,
|
||||
innerRadius: 40,
|
||||
outerRadius: 70,
|
||||
fill: 'green',
|
||||
stroke: 'blue',
|
||||
strokeWidth: 5,
|
||||
name: 'foobar',
|
||||
offset: {
|
||||
x: 0,
|
||||
y: -70
|
||||
},
|
||||
scale: {
|
||||
x: 0.5,
|
||||
y: 0.5
|
||||
}
|
||||
});
|
||||
|
||||
layer.add(star);
|
||||
stage.add(layer);
|
||||
},
|
||||
'add five point star with line join and shadow': function(containerId) {
|
||||
var stage = new Kinetic.Stage({
|
||||
container: containerId,
|
||||
width: 578,
|
||||
height: 200
|
||||
});
|
||||
var layer = new Kinetic.Layer();
|
||||
|
||||
var rect = new Kinetic.Rect({
|
||||
x: 250,
|
||||
y: 75,
|
||||
width: 100,
|
||||
height: 100,
|
||||
fill: 'red'
|
||||
});
|
||||
|
||||
var star = new Kinetic.Plugins.Star({
|
||||
x: 200,
|
||||
y: 100,
|
||||
numPoints: 5,
|
||||
innerRadius: 40,
|
||||
outerRadius: 70,
|
||||
fill: 'green',
|
||||
stroke: 'blue',
|
||||
strokeWidth: 5,
|
||||
lineJoin: "round",
|
||||
shadowColor: 'black',
|
||||
shadowBlur: 10,
|
||||
shadowOffset: [20, 20],
|
||||
shadowOpacity: 0.5,
|
||||
draggable: true
|
||||
});
|
||||
|
||||
layer.add(rect);
|
||||
layer.add(star);
|
||||
|
||||
stage.add(layer);
|
||||
|
||||
test(star.getLineJoin() === 'round', 'lineJoin property should be round');
|
||||
star.setLineJoin('bevel');
|
||||
test(star.getLineJoin() === 'bevel', 'lineJoin property should be bevel');
|
||||
|
||||
star.setLineJoin('round');
|
||||
}
|
||||
};
|
128
tests/js/unit/plugins/textPathTests.js
Normal file
128
tests/js/unit/plugins/textPathTests.js
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user