Update test helpers, basic tests, and polyfill tests

This commit is contained in:
nein09 2017-12-01 16:51:13 -08:00
parent bfb00656cc
commit 2af7db43a4
3 changed files with 166 additions and 161 deletions

View File

@ -1,4 +1,4 @@
/* global module, asyncTest, $, ok, equal, notEqual, start, test, Util */
/* global QUnit, $, Util */
(function () {
@ -64,14 +64,14 @@
},
// ----------
assessNumericValue: function ( value1, value2, variance, message ) {
ok( Util.equalsWithVariance( value1, value2, variance ), message + " Expected:" + value1 + " Found: " + value2 + " Variance: " + variance );
assessNumericValue: function ( value1, value2, variance, message, assert ) {
assert.ok( Util.equalsWithVariance( value1, value2, variance ), message + " Expected:" + value1 + " Found: " + value2 + " Variance: " + variance );
},
// ----------
assertPointsEquals: function (pointA, pointB, precision, message) {
Util.assessNumericValue(pointA.x, pointB.x, precision, message + " x: ");
Util.assessNumericValue(pointA.y, pointB.y, precision, message + " y: ");
assertPointsEquals: function (pointA, pointB, precision, message, assert) {
Util.assessNumericValue(pointA.x, pointB.x, precision, message + " x: ", assert);
Util.assessNumericValue(pointA.y, pointB.y, precision, message + " y: ", assert);
},
// ----------
@ -87,15 +87,16 @@
},
// ----------
timeWatcher: function ( time ) {
timeWatcher: function ( time, assert ) {
var done = assert.async();
time = time || 2000;
var finished = false;
setTimeout( function () {
if ( !finished ) {
finished = true;
ok( false, 'finishes in ' + time + 'ms' );
start();
assert.ok( false, 'finishes in ' + time + 'ms' );
done();
}
}, time );
@ -103,7 +104,7 @@
done: function () {
if ( !finished ) {
finished = true;
start();
done();
}
}
};
@ -124,7 +125,7 @@
},
// ----------
testDeprecation: function(obj0, member0, obj1, member1) {
testDeprecation: function(obj0, member0, obj1, member1, assert) {
var called = false;
var errored = false;
@ -144,8 +145,8 @@
});
obj0[member0]();
equal(called, true, 'called through for ' + member0);
equal(errored, true, 'errored for ' + member0);
assert.equal(called, true, 'called through for ' + member0);
assert.equal(errored, true, 'errored for ' + member0);
}
};

View File

@ -1,11 +1,11 @@
/* global module, asyncTest, $, ok, equal, notEqual, start, test, Util, testLog */
/* global QUnit, $, Util, testLog */
(function() {
var viewer;
module('Basic', {
setup: function () {
var example = $('<div id="example"></div>').appendTo("#qunit-fixture");
QUnit.module('Basic', {
beforeEach: function () {
$('<div id="example"></div>').appendTo("#qunit-fixture");
testLog.reset();
@ -15,7 +15,7 @@
springStiffness: 100 // Faster animation = faster tests
});
},
teardown: function () {
afterEach: function () {
if (viewer && viewer.close) {
viewer.close();
}
@ -25,57 +25,59 @@
});
// ----------
asyncTest('Open', function() {
ok(viewer, 'Viewer exists');
QUnit.test('Open', function(assert) {
var done = assert.async();
assert.ok(viewer, 'Viewer exists');
var openHandler = function(event) {
viewer.removeHandler('open', openHandler);
ok(true, 'Open event was sent');
ok(event, 'Handler received event data');
equal(event.eventSource, viewer, 'Sender of open event was viewer');
ok(viewer.viewport, 'Viewport exists');
ok(viewer.source, 'source exists');
ok(viewer._updateRequestId, 'timer is on');
start();
assert.ok(true, 'Open event was sent');
assert.ok(event, 'Handler received event data');
assert.equal(event.eventSource, viewer, 'Sender of open event was viewer');
assert.ok(viewer.viewport, 'Viewport exists');
assert.ok(viewer.source, 'source exists');
assert.ok(viewer._updateRequestId, 'timer is on');
done();
};
viewer.addHandler('open', openHandler);
viewer.open('/test/data/testpattern.dzi');
});
asyncTest('Open Error Handling', function() {
ok(viewer, 'Viewer exists');
QUnit.test('Open Error Handling', function(assert) {
var done = assert.async();
assert.ok(viewer, 'Viewer exists');
viewer.addHandler('open', function(event) {
ok(false, "The open event should not fire for failed opens");
start();
assert.ok(false, "The open event should not fire for failed opens");
done();
});
viewer.addHandler('open-failed', function(event) {
ok(true, "The open-failed event should be fired when the source 404s");
assert.ok(true, "The open-failed event should be fired when the source 404s");
equal($(".openseadragon-message").length, 1, "Open failures should display a message");
assert.equal($(".openseadragon-message").length, 1, "Open failures should display a message");
ok(testLog.log.contains('["AJAX request returned %d: %s",404,"/test/data/not-a-real-file"]'),
assert.ok(testLog.log.contains('["AJAX request returned %d: %s",404,"/test/data/not-a-real-file"]'),
"AJAX failures should be logged to the console");
start();
done();
});
viewer.open('/test/data/not-a-real-file');
});
// ----------
asyncTest('Zoom', function() {
QUnit.test('Zoom', function(assert) {
var done = assert.async();
viewer.addHandler("open", function () {
var viewport = viewer.viewport;
equal(viewport.getZoom(), 1, 'We start out unzoomed');
assert.equal(viewport.getZoom(), 1, 'We start out unzoomed');
var zoomHandler = function() {
viewer.removeHandler('animation-finish', zoomHandler);
equal(viewport.getZoom(), 2, 'Zoomed correctly');
start();
assert.equal(viewport.getZoom(), 2, 'Zoomed correctly');
done();
};
viewer.addHandler('animation-finish', zoomHandler);
@ -84,20 +86,20 @@
viewer.open('/test/data/testpattern.dzi');
});
// ----------
asyncTest('Pan', function() {
QUnit.test('Pan', function(assert) {
var done = assert.async();
viewer.addHandler("open", function () {
var viewport = viewer.viewport,
center = viewport.getCenter();
ok(center.x === 0.5 && center.y === 0.5, 'We start out unpanned');
assert.ok(center.x === 0.5 && center.y === 0.5, 'We start out unpanned');
var panHandler = function() {
viewer.removeHandler('animation-finish', panHandler);
center = viewport.getCenter();
Util.assessNumericValue(center.x, 0.1, 0.00001, 'panned horizontally');
Util.assessNumericValue(center.y, 0.1, 0.00001, 'panned vertically');
start();
Util.assessNumericValue(center.x, 0.1, 0.00001, 'panned horizontally', assert);
Util.assessNumericValue(center.y, 0.1, 0.00001, 'panned vertically', assert);
done();
};
viewer.addHandler('animation-finish', panHandler);
@ -107,9 +109,9 @@
viewer.open('/test/data/testpattern.dzi');
});
// ----------
asyncTest('Home', function() {
// Test setup:
QUnit.test('Home', function(assert) {
var done = assert.async();
// Test beforeEach:
function opener() {
var viewport = viewer.viewport;
viewport.panTo(new OpenSeadragon.Point(0.1, 0.1));
@ -122,15 +124,15 @@
viewer.removeHandler('animation-finish', stage1);
ok(center.x !== 0.5 && center.y !== 0.5, 'We start out panned');
notEqual(viewport.getZoom(), 1, 'We start out zoomed');
assert.ok(center.x !== 0.5 && center.y !== 0.5, 'We start out panned');
assert.notEqual(viewport.getZoom(), 1, 'We start out zoomed');
var homeHandler = function() {
viewer.removeHandler('animation-finish', homeHandler);
center = viewport.getCenter();
ok(center.x === 0.5 && center.y === 0.5, 'We end up unpanned');
equal(viewport.getZoom(), 1, 'We end up unzoomed');
start();
assert.ok(center.x === 0.5 && center.y === 0.5, 'We end up unpanned');
assert.equal(viewport.getZoom(), 1, 'We end up unzoomed');
done();
};
viewer.addHandler('animation-finish', homeHandler);
@ -143,21 +145,21 @@
viewer.open('/test/data/testpattern.dzi');
});
// ----------
asyncTest('Click', function() {
QUnit.test('Click', function(assert) {
var done = assert.async();
viewer.addHandler("open", function () {
var viewport = viewer.viewport,
center = viewport.getCenter();
ok(center.x === 0.5 && center.y === 0.5, 'We start out unpanned');
equal(viewport.getZoom(), 1, 'We start out unzoomed');
assert.ok(center.x === 0.5 && center.y === 0.5, 'We start out unpanned');
assert.equal(viewport.getZoom(), 1, 'We start out unzoomed');
var clickHandler = function() {
viewer.removeHandler('animation-finish', clickHandler);
center = viewport.getCenter();
ok(center.x > 0.37 && center.x < 0.38 && center.y > 0.37 && center.y < 0.38, 'Panned correctly');
equal(viewport.getZoom(), 2, 'Zoomed correctly');
start();
assert.ok(center.x > 0.37 && center.x < 0.38 && center.y > 0.37 && center.y < 0.38, 'Panned correctly');
assert.equal(viewport.getZoom(), 2, 'Zoomed correctly');
done();
};
viewer.addHandler('animation-finish', clickHandler);
@ -174,39 +176,39 @@
viewer.open('/test/data/testpattern.dzi');
});
// ----------
asyncTest('FullPage', function() {
QUnit.test('FullPage', function(assert) {
var done = assert.async();
viewer.addHandler("open", function () {
ok(!viewer.isFullPage(), 'Started out not fullpage');
ok(!$(viewer.element).hasClass('fullpage'),
assert.ok(!viewer.isFullPage(), 'Started out not fullpage');
assert.ok(!$(viewer.element).hasClass('fullpage'),
'No fullpage class on div');
var checkEnteringPreFullPage = function(event) {
viewer.removeHandler('pre-full-page', checkEnteringPreFullPage);
ok(event.fullPage, 'Switching to fullpage');
ok(!viewer.isFullPage(), 'Not yet fullpage');
assert.ok(event.fullPage, 'Switching to fullpage');
assert.ok(!viewer.isFullPage(), 'Not yet fullpage');
};
var checkEnteringFullPage = function(event) {
viewer.removeHandler('full-page', checkEnteringFullPage);
ok(event.fullPage, 'Switched to fullpage');
ok(viewer.isFullPage(), 'Enabled fullpage');
ok($(viewer.element).hasClass('fullpage'),
assert.ok(event.fullPage, 'Switched to fullpage');
assert.ok(viewer.isFullPage(), 'Enabled fullpage');
assert.ok($(viewer.element).hasClass('fullpage'),
'Fullpage class added to div');
var checkExitingPreFullPage = function(event) {
viewer.removeHandler('pre-full-page', checkExitingPreFullPage);
ok(!event.fullPage, 'Exiting fullpage');
ok(viewer.isFullPage(), 'Still fullpage');
assert.ok(!event.fullPage, 'Exiting fullpage');
assert.ok(viewer.isFullPage(), 'Still fullpage');
};
var checkExitingFullPage = function(event) {
viewer.removeHandler('full-page', checkExitingFullPage);
ok(!event.fullPage, 'Exiting fullpage');
ok(!viewer.isFullPage(), 'Disabled fullpage');
ok(!$(viewer.element).hasClass('fullpage'),
assert.ok(!event.fullPage, 'Exiting fullpage');
assert.ok(!viewer.isFullPage(), 'Disabled fullpage');
assert.ok(!$(viewer.element).hasClass('fullpage'),
'Fullpage class removed from div');
start();
done();
};
viewer.addHandler("pre-full-page", checkExitingPreFullPage);
@ -221,30 +223,30 @@
viewer.open('/test/data/testpattern.dzi');
});
asyncTest('FullScreen', function() {
QUnit.test('FullScreen', function(assert) {
var done = assert.async();
if (!OpenSeadragon.supportsFullScreen) {
expect(0);
start();
assert.expect(0);
done();
return;
}
viewer.addHandler("open", function () {
ok(!OpenSeadragon.isFullScreen(), 'Started out not fullscreen');
assert.ok(!OpenSeadragon.isFullScreen(), 'Started out not fullscreen');
var checkEnteringPreFullScreen = function(event) {
viewer.removeHandler('pre-full-screen', checkEnteringPreFullScreen);
ok(event.fullScreen, 'Switching to fullscreen');
ok(!OpenSeadragon.isFullScreen(), 'Not yet fullscreen');
assert.ok(event.fullScreen, 'Switching to fullscreen');
assert.ok(!OpenSeadragon.isFullScreen(), 'Not yet fullscreen');
};
// The fullscreen mode is always denied during tests so we are
// exiting directly.
var checkExitingFullScreen = function(event) {
viewer.removeHandler('full-screen', checkExitingFullScreen);
ok(!event.fullScreen, 'Exiting fullscreen');
ok(!OpenSeadragon.isFullScreen(), 'Disabled fullscreen');
start();
assert.ok(!event.fullScreen, 'Exiting fullscreen');
assert.ok(!OpenSeadragon.isFullScreen(), 'Disabled fullscreen');
done();
};
viewer.addHandler("pre-full-screen", checkEnteringPreFullScreen);
viewer.addHandler("full-screen", checkExitingFullScreen);
@ -254,16 +256,16 @@
viewer.open('/test/data/testpattern.dzi');
});
// ----------
asyncTest('Close', function() {
QUnit.test('Close', function(assert) {
var done = assert.async();
viewer.addHandler("open", function () {
var closeHandler = function() {
viewer.removeHandler('close', closeHandler);
ok(!viewer.source, 'no source');
ok(true, 'Close event was sent');
assert.ok(!viewer.source, 'no source');
assert.ok(true, 'Close event was sent');
setTimeout(function() {
ok(!viewer._updateRequestId, 'timer is off');
start();
assert.ok(!viewer._updateRequestId, 'timer is off');
done();
}, 100);
};
@ -273,11 +275,11 @@
viewer.open('/test/data/testpattern.dzi');
});
// ----------
asyncTest('Destroy', function() {
QUnit.test('Destroy', function(assert) {
var done = assert.async();
viewer.addHandler("open", function () {
// Check that the DOM has been modified
notEqual(0, $('#example').children().length);
assert.notEqual(0, $('#example').children().length);
var closeCalled = false;
var closeHandler = function() {
@ -289,14 +291,14 @@
viewer.destroy();
// Check that the DOM has been cleaned up
equal(0, $('#example').children().length);
equal(null, viewer.canvas);
equal(null, viewer.keyboardCommandArea);
equal(null, viewer.container);
equal(null, viewer.element);
equal(true, closeCalled);
assert.equal(0, $('#example').children().length);
assert.equal(null, viewer.canvas);
assert.equal(null, viewer.keyboardCommandArea);
assert.equal(null, viewer.container);
assert.equal(null, viewer.element);
assert.equal(true, closeCalled);
viewer = null;
start();
done();
});
viewer.open('/test/data/testpattern.dzi');
});
@ -319,8 +321,8 @@
img.src = corsImg;
}
asyncTest( 'CrossOriginPolicyMissing', function () {
QUnit.test( 'CrossOriginPolicyMissing', function (assert) {
var done = assert.async();
viewer.crossOriginPolicy = false;
viewer.smoothTileEdgesMinZoom = Infinity;
viewer.open( {
@ -332,19 +334,19 @@
} ]
} );
viewer.addOnceHandler('tile-drawn', function() {
ok(OpenSeadragon.isCanvasTainted(viewer.drawer.context.canvas),
assert.ok(OpenSeadragon.isCanvasTainted(viewer.drawer.context.canvas),
"Canvas should be tainted.");
start();
done();
});
} );
asyncTest( 'CrossOriginPolicyAnonymous', function () {
QUnit.test( 'CrossOriginPolicyAnonymous', function (assert) {
var done = assert.async();
browserSupportsImgCrossOrigin(function(supported) {
if (!supported) {
expect(0);
start();
assert.expect(0);
done();
} else {
viewer.crossOriginPolicy = 'Anonymous';
viewer.open( {
@ -356,21 +358,21 @@
} ]
} );
viewer.addOnceHandler('tile-drawn', function() {
ok(!OpenSeadragon.isCanvasTainted(viewer.drawer.context.canvas),
assert.ok(!OpenSeadragon.isCanvasTainted(viewer.drawer.context.canvas),
"Canvas should not be tainted.");
start();
done();
});
}
});
} );
asyncTest( 'CrossOriginPolicyOption', function () {
QUnit.test( 'CrossOriginPolicyOption', function (assert) {
var done = assert.async();
browserSupportsImgCrossOrigin(function(supported) {
if (!supported) {
expect(0);
start();
assert.expect(0);
done();
} else {
viewer.crossOriginPolicy = "Anonymous";
viewer.smoothTileEdgesMinZoom = Infinity;
@ -386,20 +388,21 @@
crossOriginPolicy : false
} );
viewer.addOnceHandler('tile-drawn', function() {
ok(OpenSeadragon.isCanvasTainted(viewer.drawer.context.canvas),
assert.ok(OpenSeadragon.isCanvasTainted(viewer.drawer.context.canvas),
"Canvas should be tainted.");
start();
done();
});
}
});
} );
asyncTest( 'CrossOriginPolicyTileSource', function () {
QUnit.test( 'CrossOriginPolicyTileSource', function (assert) {
var done = assert.async();
browserSupportsImgCrossOrigin(function(supported) {
if (!supported) {
expect(0);
start();
assert.expect(0);
done();
} else {
viewer.crossOriginPolicy = false;
viewer.smoothTileEdgesMinZoom = Infinity;
@ -415,9 +418,9 @@
}
} );
viewer.addOnceHandler('tile-drawn', function() {
ok(!OpenSeadragon.isCanvasTainted(viewer.drawer.context.canvas),
assert.ok(!OpenSeadragon.isCanvasTainted(viewer.drawer.context.canvas),
"Canvas should not be tainted.");
start();
done();
});
}
});
@ -425,8 +428,9 @@
} );
asyncTest('SetDebugMode', function() {
ok(viewer, 'Viewer exists');
QUnit.test('SetDebugMode', function(assert) {
var done = assert.async();
assert.ok(viewer, 'Viewer exists');
var checkImageTilesDebugState = function (expectedState) {
@ -443,15 +447,15 @@
//Ensure we start with debug mode turned off
viewer.setDebugMode(false);
ok(checkImageTilesDebugState(false), "All image tiles have debug mode turned off.");
ok(!viewer.debugMode, "Viewer debug mode is turned off.");
assert.ok(checkImageTilesDebugState(false), "All image tiles have debug mode turned off.");
assert.ok(!viewer.debugMode, "Viewer debug mode is turned off.");
//Turn debug mode on and check that the Viewer and all tiled images are in debug mode.
viewer.setDebugMode(true);
ok(checkImageTilesDebugState(true), "All image tiles have debug mode turned on.");
ok(viewer.debugMode, "Viewer debug mode is turned on.");
assert.ok(checkImageTilesDebugState(true), "All image tiles have debug mode turned on.");
assert.ok(viewer.debugMode, "Viewer debug mode is turned on.");
start();
done();
};
viewer.addHandler('open', openHandler);
@ -460,11 +464,11 @@
//Version numbers are injected by the build process, so skip version tests if we are only running code coverage
if(!window.isCoverageTest ){
test('version object', function() {
equal(typeof OpenSeadragon.version.versionStr, "string", "versionStr should be a string");
ok(OpenSeadragon.version.major >= 0, "major should be a positive number");
ok(OpenSeadragon.version.minor >= 0, "minor should be a positive number");
ok(OpenSeadragon.version.revision >= 0, "revision should be a positive number");
QUnit.test('version object', function(assert) {
assert.equal(typeof OpenSeadragon.version.versionStr, "string", "versionStr should be a string");
assert.ok(OpenSeadragon.version.major >= 0, "major should be a positive number");
assert.ok(OpenSeadragon.version.minor >= 0, "minor should be a positive number");
assert.ok(OpenSeadragon.version.revision >= 0, "revision should be a positive number");
});
}
})();

View File

@ -1,15 +1,15 @@
/* global module, asyncTest, $, ok, equal, notEqual, start, test, Util, testLog */
/* global QUnit, $, testLog */
( function() {
module( 'Polyfills', {
setup: function() {
QUnit.module( 'Polyfills', {
beforeEach: function() {
testLog.reset();
}
} );
// ----------
test( 'pageScroll', function() {
QUnit.test( 'pageScroll', function(assert) {
// Setup
var origWidth = $( "body" ).width(),
origHeight = $( "body" ).height();
@ -23,17 +23,17 @@
var originalGetPageScroll = OpenSeadragon.getPageScroll;
var scroll = OpenSeadragon.getPageScroll();
equal( scroll.x, 0, "Scroll should be 0 at beginning." );
equal( scroll.y, 0, "Scroll should be 0 at beginning." );
assert.equal( scroll.x, 0, "Scroll should be 0 at beginning." );
assert.equal( scroll.y, 0, "Scroll should be 0 at beginning." );
// If window.pageXOffset is not supported, the getPageScroll method should
// not have been redefined
if ( typeof ( window.pageXOffset ) != "number" ) {
equal( originalGetPageScroll, OpenSeadragon.getPageScroll,
assert.equal( originalGetPageScroll, OpenSeadragon.getPageScroll,
"OpenSeadragon.getPageScroll must not be redefined when on 0,0" +
" and window API is not supported." );
} else {
notEqual( originalGetPageScroll, OpenSeadragon.getPageScroll,
assert.notEqual( originalGetPageScroll, OpenSeadragon.getPageScroll,
"OpenSeadragon.getPageScroll must be redefined when window API " +
"is supported." );
}
@ -41,14 +41,14 @@
$( document ).scrollLeft( 200 );
$( document ).scrollTop( 100 );
scroll = originalGetPageScroll();
equal( scroll.x, 200, "First call to getScroll." );
equal( scroll.y, 100, "First call to getScroll." );
assert.equal( scroll.x, 200, "First call to getScroll." );
assert.equal( scroll.y, 100, "First call to getScroll." );
$( document ).scrollLeft( 500 );
$( document ).scrollTop( 600 );
scroll = OpenSeadragon.getPageScroll();
equal( scroll.x, 500, "Second call to getScroll." );
equal( scroll.y, 600, "Second call to getScroll." );
assert.equal( scroll.x, 500, "Second call to getScroll." );
assert.equal( scroll.y, 600, "Second call to getScroll." );
@ -60,16 +60,16 @@
$( document ).scrollTop( 0 );
var scroll = new OpenSeadragon.Point( 0, 0 );
OpenSeadragon.setPageScroll( scroll );
equal( $( document ).scrollLeft(), 0, "First call to 0,0 while already on 0,0." );
equal( $( document ).scrollTop(), 0, "First call to 0,0 while already on 0,0." );
assert.equal( $( document ).scrollLeft(), 0, "First call to 0,0 while already on 0,0." );
assert.equal( $( document ).scrollTop(), 0, "First call to 0,0 while already on 0,0." );
// If window.pageXOffset is not supported, the getPageScroll method should
// not have been redefined
if ( typeof ( window.scrollTo ) === "undefined" ) {
equal( originalSetPageScroll, OpenSeadragon.setPageScroll,
assert.equal( originalSetPageScroll, OpenSeadragon.setPageScroll,
"OpenSeadragon.setPageScroll must not be redefined when not moving." );
} else {
notEqual( originalSetPageScroll, OpenSeadragon.setPageScroll,
assert.notEqual( originalSetPageScroll, OpenSeadragon.setPageScroll,
"OpenSeadragon.setPageScroll must be redefined when window API is supported." );
}
@ -79,16 +79,16 @@
$( document ).scrollTop( 200 );
var scroll = new OpenSeadragon.Point( 100, 200 );
OpenSeadragon.setPageScroll( scroll );
equal( $( document ).scrollLeft(), 100, "First call to 100,200 while already on 100,200." );
equal( $( document ).scrollTop(), 200, "First call to 100,200 while already on 100,200." );
assert.equal( $( document ).scrollLeft(), 100, "First call to 100,200 while already on 100,200." );
assert.equal( $( document ).scrollTop(), 200, "First call to 100,200 while already on 100,200." );
// If window.pageXOffset is not supported, the getPageScroll method should
// not have been redefined
if ( typeof ( window.scrollTo ) === "undefined" ) {
equal( originalSetPageScroll, OpenSeadragon.setPageScroll,
assert.equal( originalSetPageScroll, OpenSeadragon.setPageScroll,
"OpenSeadragon.setPageScroll must not be redefined when not moving." );
} else {
notEqual( originalSetPageScroll, OpenSeadragon.setPageScroll,
assert.notEqual( originalSetPageScroll, OpenSeadragon.setPageScroll,
"OpenSeadragon.setPageScroll must be redefined when window API is supported." );
}
@ -102,9 +102,9 @@
$( document ).scrollTop( 0 );
var scroll = new OpenSeadragon.Point( 20000, 20000 );
OpenSeadragon.setPageScroll( scroll );
equal( $( document ).scrollLeft(), actualScrollLeft, "First call to position above limits." );
equal( $( document ).scrollTop(), actualScrollTop, "First call to position above limits." );
notEqual( originalSetPageScroll, OpenSeadragon.setPageScroll,
assert.equal( $( document ).scrollLeft(), actualScrollLeft, "First call to position above limits." );
assert.equal( $( document ).scrollTop(), actualScrollTop, "First call to position above limits." );
assert.notEqual( originalSetPageScroll, OpenSeadragon.setPageScroll,
"Even if outside scroll limits, OpenSeadragon.setPageScroll can be " +
"reassigned on first call." );
@ -112,9 +112,9 @@
var currentSetPageScroll = OpenSeadragon.setPageScroll;
var scroll = new OpenSeadragon.Point( 200, 200 );
OpenSeadragon.setPageScroll( scroll );
equal( $( document ).scrollLeft(), 200, "Second call." );
equal( $( document ).scrollTop(), 200, "Second call." );
equal( currentSetPageScroll, OpenSeadragon.setPageScroll,
assert.equal( $( document ).scrollLeft(), 200, "Second call." );
assert.equal( $( document ).scrollTop(), 200, "Second call." );
assert.equal( currentSetPageScroll, OpenSeadragon.setPageScroll,
"OpenSeadragon.setPageScroll must not be reassigned after first call." );