mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 15:23:44 +08:00
update toDataURL test
This commit is contained in:
parent
3336caf8e3
commit
429ef19a93
@ -280,7 +280,7 @@ suite('Node', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ======================================================
|
// ======================================================
|
||||||
test.only('toDataURL + HDPI', function(done) {
|
test('toDataURL + HDPI', function(done) {
|
||||||
var oldRatio = Konva.pixelRatio;
|
var oldRatio = Konva.pixelRatio;
|
||||||
Konva.pixelRatio = 2;
|
Konva.pixelRatio = 2;
|
||||||
|
|
||||||
@ -302,15 +302,18 @@ suite('Node', function() {
|
|||||||
stage.draw();
|
stage.draw();
|
||||||
stage.toDataURL({
|
stage.toDataURL({
|
||||||
callback : function(url) {
|
callback : function(url) {
|
||||||
console.log(url);
|
|
||||||
var img = new Image();
|
var img = new Image();
|
||||||
img.onload = function() {
|
img.onload = function() {
|
||||||
var image = new Konva.Image({
|
var image = new Konva.Image({
|
||||||
image : img
|
image : img,
|
||||||
|
scaleX: 0.5,
|
||||||
|
scaleY: 0.5
|
||||||
});
|
});
|
||||||
|
assert.equal(image.width(), stage.width() * 2, 'image has double size');
|
||||||
layer2.add(image);
|
layer2.add(image);
|
||||||
layer2.draw();
|
layer2.draw();
|
||||||
compareLayers(layer, layer2);
|
compareLayers(layer, layer2);
|
||||||
|
Konva.pixelRatio = oldRatio;
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
img.src = url;
|
img.src = url;
|
||||||
|
Loading…
Reference in New Issue
Block a user