mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
build fixes, text underline fixes
This commit is contained in:
@@ -24,4 +24,26 @@ suite('Filter', function() {
|
||||
cloneAndCompareLayer(layer, 50);
|
||||
Konva.pixelRatio = 1;
|
||||
});
|
||||
|
||||
test.skip('try to serialize node with filter', function() {
|
||||
var stage = addStage();
|
||||
var layer = new Konva.Layer();
|
||||
|
||||
var circle = new Konva.Circle({
|
||||
x: stage.width() / 2,
|
||||
y: stage.height() / 2,
|
||||
fill: 'red',
|
||||
stroke: 'green',
|
||||
radius: 15
|
||||
});
|
||||
|
||||
layer.add(circle);
|
||||
stage.add(layer);
|
||||
circle.cache();
|
||||
circle.filters([Konva.Filters.Blur]);
|
||||
circle.blurRadius(0);
|
||||
layer.draw();
|
||||
|
||||
var json = circle.toJSON();
|
||||
});
|
||||
});
|
||||
|
@@ -540,6 +540,37 @@ suite('Text', function() {
|
||||
assert.equal(layer.getContext().getTrace(), trace);
|
||||
});
|
||||
|
||||
// ======================================================
|
||||
test('text with underline and large line height', function() {
|
||||
var stage = addStage();
|
||||
var layer = new Konva.Layer();
|
||||
|
||||
var text = new Konva.Text({
|
||||
fontFamily: 'Arial',
|
||||
text: 'text',
|
||||
fontSize: 80,
|
||||
lineHeight: 2,
|
||||
textDecoration: 'underline'
|
||||
});
|
||||
|
||||
layer.add(text);
|
||||
stage.add(layer);
|
||||
|
||||
var canvas = createCanvas();
|
||||
var context = canvas.getContext('2d');
|
||||
context.translate(0, 80);
|
||||
context.lineWidth = 2;
|
||||
context.font = '80px Arial';
|
||||
context.textBaseline = 'middle';
|
||||
context.fillText('text', 0, 0);
|
||||
context.beginPath();
|
||||
context.moveTo(0, 40);
|
||||
context.lineTo(text.width(), 40);
|
||||
context.lineWidth = 80 / 15;
|
||||
context.stroke();
|
||||
compareLayerAndCanvas(layer, canvas, 50);
|
||||
});
|
||||
|
||||
test('text multi line with strike', function() {
|
||||
var stage = addStage();
|
||||
var layer = new Konva.Layer();
|
||||
|
Reference in New Issue
Block a user