From 624310a70ef59c7993e433baf4aefc13c55e3c4e Mon Sep 17 00:00:00 2001 From: Andrea Bogazzi Date: Sun, 12 Jun 2022 12:08:03 +0200 Subject: [PATCH] fixed tests --- test/unit/canvas_static.js | 9 +++++---- test/unit/object_geometry.js | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/test/unit/canvas_static.js b/test/unit/canvas_static.js index bfd770882bf..99166bedb27 100644 --- a/test/unit/canvas_static.js +++ b/test/unit/canvas_static.js @@ -1852,10 +1852,11 @@ QUnit.test('calcViewportBoundaries with flipped zoom and translation', function (assert) { assert.ok(typeof canvas.calcViewportBoundaries === 'function'); canvas.setViewportTransform([2, 0, 0, -2, -60, 60]); - assert.deepEqual(canvas.vptCoords.tl, new fabric.Point(30, -70), 'tl is 0,0'); - assert.deepEqual(canvas.vptCoords.tr, new fabric.Point(30 + canvas.getWidth() / 2, -70), 'tl is 0,0'); - assert.deepEqual(canvas.vptCoords.bl, new fabric.Point(30, canvas.getHeight() / 2 - 70), 'tl is 0,0'); - assert.deepEqual(canvas.vptCoords.br, new fabric.Point(30 + canvas.getWidth() / 2, canvas.getHeight() / 2 - 70), 'tl is 0,0'); + canvas.calcViewportBoundaries(); + assert.deepEqual({ x: canvas.vptCoords.tl.x, y: canvas.vptCoords.tl.y }, { x: 30, y: -145 }, 'tl is 30, -145'); + assert.deepEqual({ x: canvas.vptCoords.tr.x, y: canvas.vptCoords.tr.y }, { x: 130, y: -145 }, 'tr is 130, -145'); + assert.deepEqual({ x: canvas.vptCoords.bl.x, y: canvas.vptCoords.bl.y }, { x: 30, y: 30 }, 'bl is 30,-70'); + assert.deepEqual({ x: canvas.vptCoords.br.x, y: canvas.vptCoords.br.y }, { x: 130, y: 30 }, 'br is 130,-70'); }); QUnit.test('_isRetinaScaling', function(assert) { diff --git a/test/unit/object_geometry.js b/test/unit/object_geometry.js index 4dfc669e945..129f661ddb3 100644 --- a/test/unit/object_geometry.js +++ b/test/unit/object_geometry.js @@ -869,8 +869,8 @@ cObj.top = -110; cObj.setCoords(); assert.equal(cObj.isPartiallyOnScreen(true), false,'object is completely offScreen and not partial'); - cObj.left = 50; - cObj.top = 50; + cObj.left = 45; + cObj.top = 45; cObj.setCoords(); assert.equal(cObj.isPartiallyOnScreen(true), false, 'object is completely on screen and not partial'); canvas.setZoom(2);