From 0fdfd0033fb2297ced7efb788d7232538fa3772d Mon Sep 17 00:00:00 2001 From: Jonathan Puckey Date: Sat, 21 May 2011 20:36:30 +0200 Subject: [PATCH] Tests helpers: add compareSegmentPoints function. --- test/lib/helpers.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/lib/helpers.js b/test/lib/helpers.js index 785532ba..9cc4f3e7 100644 --- a/test/lib/helpers.js +++ b/test/lib/helpers.js @@ -193,6 +193,21 @@ function compareParagraphStyles(paragraphStyle, paragraphStyle2, checkIdentity) }); } +function compareSegmentPoints(segmentPoint, segmentPoint2, checkIdentity) { + if (checkIdentity) { + equals(function() { + return segmentPoint !== segmentPoint2; + }, true); + } + var keys = ['selected', 'x', 'y']; + for (var i = 0, l = keys.length; i < l; i++) { + var key = keys[i]; + equals(function() { + return segmentPoint[key] == segmentPoint2[key]; + }, true, 'Compare SegmentPoint#' + key); + } +} + function compareSegments(segment, segment2, checkIdentity) { var keys = ['handleIn', 'handleOut', 'point']; if (checkIdentity) {