mirror of
https://github.com/konvajs/konva.git
synced 2025-09-18 09:50:05 +08:00
cleaned up unit test data urls. All unit tests now pass with no warnings
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -8,14 +8,6 @@
|
||||
<script src="../assets/tiger.js"></script>
|
||||
<script src="../assets/unitDataUrls.js"></script>
|
||||
|
||||
<!-- data urls -->
|
||||
<script src="../dataUrls/groupToImage.js"></script>
|
||||
<script src="../dataUrls/customShapeTwoFills.js"></script>
|
||||
<script src="../dataUrls/cloneGroup.js"></script>
|
||||
<script src="../dataUrls/nodeShapeTypeSelector.js"></script>
|
||||
<script src="../dataUrls/multiLineTextWithShadows.js"></script>
|
||||
|
||||
|
||||
<script src="../js/Test.js"></script>
|
||||
<script src="../js/unitTests.js"></script>
|
||||
<script>
|
||||
|
@@ -784,7 +784,7 @@ Test.Modules.CONTAINER = {
|
||||
|
||||
stage.toDataURL({
|
||||
callback: function(dataUrl) {
|
||||
test(dataUrl === nodeShapeTypeSelector, 'problem with node and shape type selector render.');
|
||||
test(dataUrl === dataUrls['node shape type selector'], 'problem with node and shape type selector render.');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
@@ -124,7 +124,7 @@ Test.Modules.NODE = {
|
||||
|
||||
var dataUrl = layer.toDataURL();
|
||||
|
||||
warn(dataUrl === groupToImageDataUrl, 'group to image data url is incorrect');
|
||||
warn(dataUrl === dataUrls['group to image'], 'group to image data url is incorrect');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -388,7 +388,9 @@ Test.Modules.NODE = {
|
||||
|
||||
stage.draw();
|
||||
|
||||
warn(layer.toDataURL() === cloneGroup, 'problem cloning group');
|
||||
//console.log(layer.toDataURL());
|
||||
|
||||
warn(layer.toDataURL() === dataUrls['clone group'], 'problem cloning group');
|
||||
|
||||
|
||||
},
|
||||
@@ -774,7 +776,7 @@ Test.Modules.NODE = {
|
||||
|
||||
layer.draw();
|
||||
//console.log(layer.toDataURL());
|
||||
warn(dataUrls['regular and cahced polygon'] === layer.toDataURL(), 'regular and cached polygon layer data url is incorrect');
|
||||
warn(dataUrls['regular and cached polygon'] === layer.toDataURL(), 'regular and cached polygon layer data url is incorrect');
|
||||
|
||||
|
||||
});
|
||||
@@ -2013,8 +2015,6 @@ Test.Modules.NODE = {
|
||||
test(stage.toJSON() === json, "problem loading stage with json");
|
||||
},
|
||||
'serialize stage with custom shape': function(containerId) {
|
||||
var urls = dataUrls['STAGE - serialize stage with custom shape'];
|
||||
|
||||
var stage = new Kinetic.Stage({
|
||||
container: containerId,
|
||||
width: 578,
|
||||
@@ -2046,7 +2046,7 @@ Test.Modules.NODE = {
|
||||
|
||||
var startDataUrl = layer.toDataURL();
|
||||
|
||||
//warn(startDataUrl === urls[0], 'start data url is incorrect');
|
||||
warn(startDataUrl === dataUrls['serialize stage with custom shape'], 'start data url is incorrect');
|
||||
test(triangle.getId() === 'myTriangle', 'triangle id should be myTriangle');
|
||||
|
||||
//console.log(stage.toJSON());
|
||||
@@ -2062,7 +2062,7 @@ Test.Modules.NODE = {
|
||||
layer.draw();
|
||||
|
||||
var endDataUrl = layer.toDataURL();
|
||||
//warn(endDataUrl === urls[0], 'end data url is incorrect');
|
||||
warn(endDataUrl === dataUrls['serialize stage with custom shape'], 'end data url is incorrect');
|
||||
|
||||
},
|
||||
'load stage with custom shape using json': function(containerId) {
|
||||
|
@@ -59,32 +59,14 @@ Test.Modules.SHAPE = {
|
||||
context.lineTo(420, 80);
|
||||
context.quadraticCurveTo(300, 100, 260, 170);
|
||||
context.closePath();
|
||||
this.fill(context, 'red');
|
||||
this.stroke(context, 'black', this.getStrokeWidth(), {
|
||||
color: 'black',
|
||||
offset: {
|
||||
x: 20,
|
||||
y: 20
|
||||
},
|
||||
opacity: 0.5
|
||||
});
|
||||
this.fillStroke(context);
|
||||
|
||||
context.beginPath();
|
||||
context.moveTo(300, 150);
|
||||
context.lineTo(520, 180);
|
||||
context.quadraticCurveTo(400, 200, 360, 270);
|
||||
context.closePath();
|
||||
|
||||
this.fill(context, 'green', {
|
||||
color: 'black',
|
||||
offset: {
|
||||
x: 20,
|
||||
y: 20
|
||||
},
|
||||
opacity: 0.5
|
||||
});
|
||||
|
||||
this.stroke(context, 'yellow', this.getStrokeWidth());
|
||||
this.fillStroke(context);
|
||||
};
|
||||
var triangle = new Kinetic.Shape({
|
||||
drawFunc: drawTriangle,
|
||||
@@ -92,12 +74,20 @@ Test.Modules.SHAPE = {
|
||||
stroke: "black",
|
||||
strokeWidth: 4,
|
||||
id: 'myTriangle',
|
||||
draggable: true
|
||||
draggable: true,
|
||||
shadow: {
|
||||
color: 'black',
|
||||
opacity: 0.5,
|
||||
blur: 10,
|
||||
offset: 10
|
||||
}
|
||||
});
|
||||
|
||||
stage.add(layer.add(triangle));
|
||||
|
||||
warn(layer.toDataURL() === customShapeTwoFills, 'problem with custom shape with two fills');
|
||||
var dataUrl = layer.toDataURL();
|
||||
//console.log(dataUrl);
|
||||
warn(dataUrl === dataUrls['custom shape with two fills and strokes'], 'problem with custom shape with two fills');
|
||||
|
||||
},
|
||||
'custom shape with fill, stroke, and strokeWidth': function(containerId) {
|
||||
@@ -125,7 +115,7 @@ Test.Modules.SHAPE = {
|
||||
});
|
||||
|
||||
layer.add(shape);
|
||||
stage.add(layer);
|
||||
stage.add(layer);
|
||||
},
|
||||
'change custom shape draw func': function(containerId) {
|
||||
var stage = new Kinetic.Stage({
|
||||
@@ -187,6 +177,6 @@ Test.Modules.SHAPE = {
|
||||
|
||||
var dataUrl = layer.toDataURL();
|
||||
|
||||
test(dataUrls['SHAPE - change custom shape draw func'] === dataUrl, 'problem with setDrawFunc');
|
||||
test(dataUrls['change custom shape draw func'] === dataUrl, 'problem with setDrawFunc');
|
||||
}
|
||||
};
|
||||
|
@@ -151,7 +151,7 @@ Test.Modules.IMAGE = {
|
||||
layer.draw();
|
||||
var dataUrl = layer.toDataURL();
|
||||
//console.log(dataUrl);
|
||||
warn(dataUrl === dataUrls['Filters - grayscale image'], 'problem with Grayscale filter.');
|
||||
warn(dataUrl === dataUrls['grayscale image'], 'problem with Grayscale filter.');
|
||||
});
|
||||
};
|
||||
imageObj.src = '../assets/darth-vader.jpg';
|
||||
@@ -184,7 +184,7 @@ Test.Modules.IMAGE = {
|
||||
layer.draw();
|
||||
var dataUrl = layer.toDataURL();
|
||||
//console.log(dataUrl);
|
||||
//warn(dataUrl === dataUrls['Filters - invert image'], 'problem with Invert filter.');
|
||||
warn(dataUrl === dataUrls['invert image'], 'problem with Invert filter.');
|
||||
|
||||
});
|
||||
};
|
||||
@@ -220,14 +220,13 @@ Test.Modules.IMAGE = {
|
||||
layer.draw();
|
||||
var dataUrl = layer.toDataURL();
|
||||
//console.log(dataUrl);
|
||||
warn(dataUrl === dataUrls['Filters - adjust image brightness'], 'problem with Brighten filter.');
|
||||
warn(dataUrl === dataUrls['adjust image brightness'], 'problem with Brighten filter.');
|
||||
|
||||
});
|
||||
};
|
||||
imageObj.src = '../assets/darth-vader.jpg';
|
||||
},
|
||||
'filter transformed image': function(containerId) {
|
||||
var urls = dataUrls['SHAPE - filter transformed image'];
|
||||
var imageObj = new Image();
|
||||
imageObj.onload = function() {
|
||||
var stage = new Kinetic.Stage({
|
||||
@@ -260,7 +259,8 @@ Test.Modules.IMAGE = {
|
||||
darth.applyFilter(Kinetic.Filters.Grayscale, null, function() {
|
||||
//stage.start();
|
||||
layer.draw();
|
||||
warn(layer.toDataURL() === urls[0], 'data url is incorrect');
|
||||
//console.log(layer.toDataURL());
|
||||
warn(layer.toDataURL() === dataUrls['filter transformed image'], 'problem filtering transformed image');
|
||||
|
||||
});
|
||||
};
|
||||
|
@@ -321,8 +321,8 @@ Test.Modules.Text = {
|
||||
|
||||
layer.add(text);
|
||||
stage.add(layer);
|
||||
|
||||
warn(layer.toDataURL() === multiLineTextWithShadows, 'multi line text with shadows data url is incorrect');
|
||||
|
||||
warn(layer.toDataURL() === dataUrls['multiline text with shadows'], 'multi line text with shadows data url is incorrect');
|
||||
},
|
||||
'change font size should update text data': function(containerId) {
|
||||
var stage = new Kinetic.Stage({
|
||||
|
Reference in New Issue
Block a user