diff --git a/test/modules/viewport.js b/test/modules/viewport.js index fb94d11d..e49c1e68 100644 --- a/test/modules/viewport.js +++ b/test/modules/viewport.js @@ -105,7 +105,8 @@ orig = config.getOrig(config.testArray[i], viewport); expected = config.getExpected(orig, viewport); actual = viewport[config.method](orig); - propEqual( + var assert = config.assert || propEqual; + assert( actual, expected, "Correctly converted coordinates " + orig @@ -118,6 +119,10 @@ viewer.open(DZI_PATH); }; + function assertPointsEquals(actual, expected, message) { + Util.assertPointsEquals(actual, expected, 1e-15, message); + } + // Tests start here. asyncTest('getContainerSize', function() { @@ -872,7 +877,8 @@ getExpected: function(orig, viewport) { return orig.divide(viewer.source.dimensions.x); }, - method: 'imageToViewportCoordinates' + method: 'imageToViewportCoordinates', + assert: assertPointsEquals }); }); @@ -885,7 +891,8 @@ getExpected: function(orig, viewport) { return orig.divide(ZOOM_FACTOR * viewport.getContainerSize().x); }, - method: 'imageToViewportCoordinates' + method: 'imageToViewportCoordinates', + assert: assertPointsEquals }); }); asyncTest('imageToViewportRectangle', function() { @@ -902,7 +909,8 @@ orig.height / viewer.source.dimensions.x ); }, - method: 'imageToViewportRectangle' + method: 'imageToViewportRectangle', + assert: assertPointsEquals }); });