1
0
mirror of https://github.com/konvajs/konva.git synced 2025-04-05 20:48:28 +08:00

test for image will fill pattern.

This commit is contained in:
Anton Lavrenov 2021-05-06 16:09:28 -05:00
parent b6e9d58db8
commit e5d86c9981

View File

@ -124,6 +124,36 @@ describe('Image', function () {
});
});
// ======================================================
it('try image will fill pattern', function (done) {
loadImage('darth-vader.jpg', (imageObj) => {
loadImage('lion.png', (lion) => {
var stage = addStage();
var layer = new Konva.Layer();
var darth = new Konva.Image({
x: 20,
y: 20,
image: lion,
draggable: true,
fillPatternImage: imageObj,
fillPatternRepeat: 'no-repeat',
fillPatternX: 50,
});
layer.add(darth);
stage.add(layer);
assert.equal(
layer.getContext().getTrace(true),
'clearRect();save();transform();beginPath();rect();closePath();fillStyle;fill();drawImage();restore();'
);
done();
});
});
});
// ======================================================
it('crop and scale image', function (done) {
loadImage('darth-vader.jpg', (imageObj) => {