From 7d3d7351abb3c9ac396bc04c14410cdccfff3494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sat, 31 Dec 2016 01:07:50 +0100 Subject: [PATCH] Implement more PathItem#compare() tests. Two failing for now. --- test/tests/PathItem.js | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/test/tests/PathItem.js b/test/tests/PathItem.js index 41b89e28..ea2b93ec 100644 --- a/test/tests/PathItem.js +++ b/test/tests/PathItem.js @@ -126,9 +126,18 @@ test('PathItem#compare()', function() { radius: 100 }); var square = new Path.Rectangle({ - point: [0, 0], + point: [100, 100], size: [100, 100] }); + + var square2 = square.clone(); + square2.divideAt(50); + square2.divideAt(150); + + var circle2 = circle.clone(); + circle2.divideAt(50); + circle2.divideAt(100); + equals(function() { return square.compare(null); }, false, 'Comparing with an invalid item should return false.'); @@ -145,9 +154,15 @@ test('PathItem#compare()', function() { return circle.compare(circle.clone()); }, true, 'Comparing a circle with its clone should return true.'); equals(function() { - return square.compare(square.clone().rotate(90)); - }, true, 'Comparing a square with its rotated clone should return true.'); + return square.compare(square2); + }, true, 'Comparing a square with an identical square with additional segments should return true.'); equals(function() { - return circle.compare(circle.clone().rotate(90)); - }, true, 'Comparing a circle with its rotated clone should return true.'); + return square2.compare(square); + }, true, 'Comparing a square with an identical square with additional segments should return true.'); + equals(function() { + return circle.compare(circle2); + }, true, 'Comparing a circle with an identical circle with additional segments should return true.'); + equals(function() { + return circle2.compare(circle); + }, true, 'Comparing a circle with an identical circle with additional segments should return true.'); });