From d9bd3343cc975c45dea173c93c7d3dacac7a8453 Mon Sep 17 00:00:00 2001 From: nein09 Date: Wed, 15 Oct 2014 17:00:11 -0700 Subject: [PATCH] viewerElementToImageCoordinates --- test/viewport.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/viewport.js b/test/viewport.js index 941ea3d3..5dcbb0d3 100644 --- a/test/viewport.js +++ b/test/viewport.js @@ -47,6 +47,25 @@ viewer.open('/test/data/testpattern.dzi'); }); */ +asyncTest('viewerElementToImageCoordinates', function() { + var openHandler = function(event) { + viewer.removeHandler('open', openHandler); + var viewport = viewer.viewport; + + var orig = new OpenSeadragon.Point( + getRandom(0, 500), getRandom(0, 500) + ); + // The image is twice as large as the viewer. + var expected = orig.times(2); + var actual = viewport.viewerElementToImageCoordinates(orig); + propEqual(actual, expected, "Coordinates converted correctly for " + orig); + + start(); + }; + viewer.addHandler('open', openHandler); + viewer.open('/test/data/testpattern.dzi'); + }); + asyncTest('imageToViewerElementCoordinates', function() { var openHandler = function(event) { viewer.removeHandler('open', openHandler);