diff --git a/test/viewport.js b/test/viewport.js index 86e0bf8f..1fb7349a 100644 --- a/test/viewport.js +++ b/test/viewport.js @@ -33,6 +33,7 @@ var VIEWER_PADDING = new OpenSeadragon.Point(0.25, 0.25); var DZI_PATH = '/test/data/testpattern.dzi'; var TALL_PATH = '/test/data/tall.dzi'; + var WIDE_PATH = '/test/data/wide.dzi'; var testZoomLevels = [-1, 0, 0.1, 0.5, 4, 10]; @@ -277,6 +278,38 @@ viewer.open(TALL_PATH); // use a different image for homeFillsViewer }); + asyncTest('fitHorizontally', function(){ + var openHandler = function(event) { + viewer.removeHandler('open', openHandler); + var viewport = viewer.viewport; + viewport.fitHorizontally(true); + viewport.update(); + propEqual( + viewport.getBounds(), + new OpenSeadragon.Point(0,0), + "Viewport fit a tall image horizontally." + ); + }; + viewer.addHandler('open', openHandler); + viewer.open(TALL_PATH); + }); + + asyncTest('fitVertically', function(){ + var openHandler = function(event) { + viewer.removeHandler('open', openHandler); + var viewport = viewer.viewport; + viewport.fitVertically(true); + viewport.update(); + propEqual( + viewport.getBounds(), + new OpenSeadragon.Point(0,0), + "Viewport fit a wide image vertically." + ); + }; + viewer.addHandler('open', openHandler); + viewer.open(WIDE_PATH); + }); + asyncTest('panBy', function(){ var openHandler = function(event) { viewer.removeHandler('open', openHandler);