From fbcf78c894d837c0c165508b8a1bdd1e2f843794 Mon Sep 17 00:00:00 2001
From: Antoine Vandecreme <ant.vand@gmail.com>
Date: Sun, 28 Aug 2016 19:59:36 +0200
Subject: [PATCH] Fix tests.

---
 test/modules/viewport.js | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

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
         });
     });