2017-12-05 05:41:08 +03:00
|
|
|
/* global QUnit, $, testLog */
|
2014-04-07 22:11:33 +04:00
|
|
|
|
|
|
|
(function () {
|
|
|
|
var viewer;
|
|
|
|
|
2017-12-05 05:41:08 +03:00
|
|
|
QUnit.module('Controls', {
|
|
|
|
beforeEach: function () {
|
|
|
|
$('<div id="controlsTests"></div>')
|
2014-08-20 02:27:04 +04:00
|
|
|
.css({
|
|
|
|
width: 1000,
|
|
|
|
height: 1000
|
|
|
|
})
|
|
|
|
.appendTo("#qunit-fixture");
|
2014-04-07 22:11:33 +04:00
|
|
|
|
|
|
|
testLog.reset();
|
|
|
|
|
|
|
|
},
|
2017-12-05 05:41:08 +03:00
|
|
|
afterEach: function () {
|
2014-04-07 22:11:33 +04:00
|
|
|
if (viewer && viewer.close) {
|
|
|
|
viewer.close();
|
|
|
|
}
|
2023-06-30 00:06:45 +03:00
|
|
|
// if (viewer && viewer.destroy){
|
|
|
|
// viewer.destroy();
|
|
|
|
// }
|
2014-04-07 22:11:33 +04:00
|
|
|
|
|
|
|
viewer = null;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2017-12-05 05:41:08 +03:00
|
|
|
QUnit.test('ZoomControlOff', function (assert) {
|
|
|
|
var done = assert.async();
|
2014-04-07 22:11:33 +04:00
|
|
|
var openHandler = function () {
|
|
|
|
viewer.removeHandler('open', openHandler);
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.ok(!viewer.showZoomControl, 'showZoomControl should be off');
|
|
|
|
assert.ok(!viewer.zoomInButton, "zoomIn button should be null");
|
|
|
|
assert.ok(!viewer.zoomOutButton, "zoomOut button should be null");
|
2014-04-07 22:11:33 +04:00
|
|
|
|
|
|
|
viewer.close();
|
2017-12-05 05:41:08 +03:00
|
|
|
done();
|
2014-04-07 22:11:33 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
viewer = OpenSeadragon({
|
|
|
|
id: 'controlsTests',
|
|
|
|
prefixUrl: '/build/openseadragon/images/',
|
|
|
|
springStiffness: 100, // Faster animation = faster tests
|
|
|
|
showZoomControl: false
|
|
|
|
});
|
|
|
|
viewer.addHandler('open', openHandler);
|
|
|
|
viewer.open('/test/data/testpattern.dzi');
|
|
|
|
});
|
|
|
|
|
2017-12-05 05:41:08 +03:00
|
|
|
QUnit.test('ZoomControlOn', function (assert) {
|
|
|
|
var done = assert.async();
|
2014-04-07 22:11:33 +04:00
|
|
|
var openHandler = function () {
|
|
|
|
viewer.removeHandler('open', openHandler);
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.ok(viewer.showZoomControl, 'showZoomControl should be on');
|
|
|
|
assert.ok(!!viewer.zoomInButton, "zoomIn button should not be null");
|
|
|
|
assert.ok(!!viewer.zoomOutButton, "zoomOut button should not be null");
|
2020-12-18 21:25:29 +03:00
|
|
|
assert.notEqual(viewer.buttonGroup.buttons.indexOf(viewer.zoomInButton), -1,
|
2014-04-07 22:11:33 +04:00
|
|
|
"The zoomIn button should be present");
|
2020-12-18 21:25:29 +03:00
|
|
|
assert.notEqual(viewer.buttonGroup.buttons.indexOf(viewer.zoomOutButton), -1,
|
2014-04-07 22:11:33 +04:00
|
|
|
"The zoomOut button should be present");
|
|
|
|
|
|
|
|
var oldZoom = viewer.viewport.getZoom();
|
|
|
|
viewer.zoomInButton.onClick();
|
|
|
|
var newZoom = viewer.viewport.getZoom();
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.ok(oldZoom < newZoom, "OSD should have zoomed in.");
|
2014-04-07 22:11:33 +04:00
|
|
|
oldZoom = newZoom;
|
|
|
|
viewer.zoomOutButton.onClick();
|
|
|
|
newZoom = viewer.viewport.getZoom();
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.ok(oldZoom > newZoom, "OSD should have zoomed out.");
|
2014-04-07 22:11:33 +04:00
|
|
|
|
|
|
|
viewer.close();
|
2017-12-05 05:41:08 +03:00
|
|
|
done();
|
2014-04-07 22:11:33 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
viewer = OpenSeadragon({
|
|
|
|
id: 'controlsTests',
|
|
|
|
prefixUrl: '/build/openseadragon/images/',
|
|
|
|
springStiffness: 100, // Faster animation = faster tests
|
|
|
|
showZoomControl: true
|
|
|
|
});
|
|
|
|
viewer.addHandler('open', openHandler);
|
|
|
|
viewer.open('/test/data/testpattern.dzi');
|
|
|
|
});
|
|
|
|
|
2017-12-05 05:41:08 +03:00
|
|
|
QUnit.test('HomeControlOff', function (assert) {
|
|
|
|
var done = assert.async();
|
2014-04-07 22:11:33 +04:00
|
|
|
var openHandler = function () {
|
|
|
|
viewer.removeHandler('open', openHandler);
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.ok(!viewer.showHomeControl, 'showHomeControl should be off');
|
|
|
|
assert.ok(!viewer.homeButton, "Home button should be null");
|
2014-04-07 22:11:33 +04:00
|
|
|
|
|
|
|
viewer.close();
|
2017-12-05 05:41:08 +03:00
|
|
|
done();
|
2014-04-07 22:11:33 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
viewer = OpenSeadragon({
|
|
|
|
id: 'controlsTests',
|
|
|
|
prefixUrl: '/build/openseadragon/images/',
|
|
|
|
springStiffness: 100, // Faster animation = faster tests
|
|
|
|
showHomeControl: false
|
|
|
|
});
|
|
|
|
viewer.addHandler('open', openHandler);
|
|
|
|
viewer.open('/test/data/testpattern.dzi');
|
|
|
|
});
|
|
|
|
|
2017-12-05 05:41:08 +03:00
|
|
|
QUnit.test('HomeControlOn', function (assert) {
|
|
|
|
var done = assert.async();
|
2014-04-07 22:11:33 +04:00
|
|
|
var openHandler = function () {
|
|
|
|
viewer.removeHandler('open', openHandler);
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.ok(viewer.showHomeControl, 'showHomeControl should be on');
|
|
|
|
assert.ok(!!viewer.homeButton, "Home button should not be null");
|
2020-12-18 21:25:29 +03:00
|
|
|
assert.notEqual(viewer.buttonGroup.buttons.indexOf(viewer.homeButton), -1,
|
2014-04-07 22:11:33 +04:00
|
|
|
"The home button should be present");
|
|
|
|
|
|
|
|
viewer.viewport.zoomBy(1.1);
|
|
|
|
var bounds = viewer.viewport.getBounds();
|
|
|
|
var homeBounds = viewer.viewport.getHomeBounds();
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.ok(bounds.x !== homeBounds.x ||
|
2014-04-07 22:11:33 +04:00
|
|
|
bounds.y !== homeBounds.y ||
|
|
|
|
bounds.width !== homeBounds.width ||
|
|
|
|
bounds.height !== homeBounds.height,
|
|
|
|
"OSD should not be at home.");
|
|
|
|
viewer.homeButton.onRelease();
|
|
|
|
bounds = viewer.viewport.getBounds();
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.ok(bounds.x === homeBounds.x &&
|
2014-04-07 22:11:33 +04:00
|
|
|
bounds.y === homeBounds.y &&
|
|
|
|
bounds.width === homeBounds.width &&
|
|
|
|
bounds.height === homeBounds.height, "OSD should have get home.");
|
|
|
|
|
|
|
|
viewer.close();
|
2017-12-05 05:41:08 +03:00
|
|
|
done();
|
2014-04-07 22:11:33 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
viewer = OpenSeadragon({
|
|
|
|
id: 'controlsTests',
|
|
|
|
prefixUrl: '/build/openseadragon/images/',
|
|
|
|
springStiffness: 100, // Faster animation = faster tests
|
|
|
|
showHomeControl: true
|
|
|
|
});
|
|
|
|
viewer.addHandler('open', openHandler);
|
|
|
|
viewer.open('/test/data/testpattern.dzi');
|
|
|
|
});
|
|
|
|
|
2017-12-05 05:41:08 +03:00
|
|
|
QUnit.test('FullPageControlOff', function (assert) {
|
|
|
|
var done = assert.async();
|
2014-04-07 22:11:33 +04:00
|
|
|
var openHandler = function () {
|
|
|
|
viewer.removeHandler('open', openHandler);
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.ok(!viewer.showFullPageControl, 'showFullPageControl should be off');
|
|
|
|
assert.ok(!viewer.fullPageButton, "FullPage button should be null");
|
2014-04-07 22:11:33 +04:00
|
|
|
|
|
|
|
viewer.close();
|
2017-12-05 05:41:08 +03:00
|
|
|
done();
|
2014-04-07 22:11:33 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
viewer = OpenSeadragon({
|
|
|
|
id: 'controlsTests',
|
|
|
|
prefixUrl: '/build/openseadragon/images/',
|
|
|
|
springStiffness: 100, // Faster animation = faster tests
|
|
|
|
showFullPageControl: false
|
|
|
|
});
|
|
|
|
viewer.addHandler('open', openHandler);
|
|
|
|
viewer.open('/test/data/testpattern.dzi');
|
|
|
|
});
|
|
|
|
|
2017-12-05 05:41:08 +03:00
|
|
|
QUnit.test('FullPageControlOn', function (assert) {
|
|
|
|
var done = assert.async();
|
2014-04-07 22:11:33 +04:00
|
|
|
var openHandler = function () {
|
|
|
|
viewer.removeHandler('open', openHandler);
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.ok(viewer.showHomeControl, 'showFullPageControl should be on');
|
|
|
|
assert.ok(!!viewer.fullPageButton, "FullPage button should not be null");
|
2020-12-18 21:25:29 +03:00
|
|
|
assert.notEqual(viewer.buttonGroup.buttons.indexOf(viewer.fullPageButton), -1,
|
2014-04-07 22:11:33 +04:00
|
|
|
"The full page button should be present");
|
|
|
|
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.ok(!viewer.isFullPage(), "OSD should not be in full page.");
|
2014-04-07 22:11:33 +04:00
|
|
|
viewer.fullPageButton.onRelease();
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.ok(viewer.isFullPage(), "OSD should be in full page.");
|
2014-04-07 22:11:33 +04:00
|
|
|
viewer.fullPageButton.onRelease();
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.ok(!viewer.isFullPage(), "OSD should not be in full page.");
|
2014-04-07 22:11:33 +04:00
|
|
|
|
|
|
|
viewer.close();
|
2017-12-05 05:41:08 +03:00
|
|
|
done();
|
2014-04-07 22:11:33 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
viewer = OpenSeadragon({
|
|
|
|
id: 'controlsTests',
|
|
|
|
prefixUrl: '/build/openseadragon/images/',
|
|
|
|
springStiffness: 100, // Faster animation = faster tests
|
|
|
|
showHomeControl: true
|
|
|
|
});
|
|
|
|
viewer.addHandler('open', openHandler);
|
|
|
|
viewer.open('/test/data/testpattern.dzi');
|
|
|
|
});
|
|
|
|
|
2017-12-05 05:41:08 +03:00
|
|
|
QUnit.test('RotateControlOff', function (assert) {
|
|
|
|
var done = assert.async();
|
2014-04-07 22:11:33 +04:00
|
|
|
var openHandler = function (event) {
|
|
|
|
viewer.removeHandler('open', openHandler);
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.ok(true, 'Open event was sent');
|
|
|
|
assert.ok(viewer.drawer, 'Drawer exists');
|
|
|
|
assert.ok(viewer.drawer.canRotate(), 'drawer.canRotate needs to be true');
|
|
|
|
assert.ok(!viewer.showRotationControl, 'showRotationControl should be off');
|
|
|
|
assert.ok(!viewer.rotateLeftButton, "rotateLeft button should be null");
|
|
|
|
assert.ok(!viewer.rotateRightButton, "rotateRight button should be null");
|
2014-04-07 22:11:33 +04:00
|
|
|
|
|
|
|
viewer.close();
|
2017-12-05 05:41:08 +03:00
|
|
|
done();
|
2014-04-07 22:11:33 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
viewer = OpenSeadragon({
|
|
|
|
id: 'controlsTests',
|
|
|
|
prefixUrl: '/build/openseadragon/images/',
|
|
|
|
springStiffness: 100, // Faster animation = faster tests
|
|
|
|
showRotationControl: false
|
|
|
|
});
|
|
|
|
viewer.addHandler('open', openHandler);
|
|
|
|
viewer.open('/test/data/testpattern.dzi');
|
|
|
|
});
|
|
|
|
|
2017-12-05 05:41:08 +03:00
|
|
|
QUnit.test('RotateControlOn', function (assert) {
|
|
|
|
var done = assert.async();
|
2014-04-07 22:11:33 +04:00
|
|
|
var openHandler = function (event) {
|
|
|
|
viewer.removeHandler('open', openHandler);
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.ok(true, 'Open event was sent');
|
|
|
|
assert.ok(viewer.drawer, 'Drawer exists');
|
|
|
|
assert.ok(viewer.drawer.canRotate(), 'drawer.canRotate needs to be true');
|
|
|
|
assert.ok(viewer.showRotationControl, 'showRotationControl should be true');
|
2020-12-18 21:25:29 +03:00
|
|
|
assert.notEqual(viewer.buttonGroup.buttons.indexOf(viewer.rotateLeftButton), -1,
|
2014-04-07 22:11:33 +04:00
|
|
|
"rotateLeft should be found");
|
2020-12-18 21:25:29 +03:00
|
|
|
assert.notEqual(viewer.buttonGroup.buttons.indexOf(viewer.rotateRightButton), -1,
|
2014-04-07 22:11:33 +04:00
|
|
|
"rotateRight should be found");
|
|
|
|
|
|
|
|
// Now simulate the left/right button clicks.
|
|
|
|
// TODO: re-factor simulateViewerClickWithDrag so it'll accept any element, and use that.
|
2022-03-31 00:05:14 +03:00
|
|
|
assert.equal(viewer.viewport.getRotation(), 0, "Image should start at 0 degrees rotation");
|
2014-04-07 22:11:33 +04:00
|
|
|
viewer.rotateLeftButton.onRelease();
|
2022-03-31 00:05:14 +03:00
|
|
|
assert.equal(viewer.viewport.getRotation(), -90, "Image should be -90 degrees rotation (left)");
|
2014-04-07 22:11:33 +04:00
|
|
|
viewer.rotateRightButton.onRelease();
|
2022-03-31 00:05:14 +03:00
|
|
|
assert.equal(viewer.viewport.getRotation(), 0, "Image should be 0 degrees rotation (right)");
|
2014-04-07 22:11:33 +04:00
|
|
|
|
|
|
|
viewer.close();
|
2017-12-05 05:41:08 +03:00
|
|
|
done();
|
2014-04-07 22:11:33 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
viewer = OpenSeadragon({
|
|
|
|
id: 'controlsTests',
|
|
|
|
prefixUrl: '/build/openseadragon/images/',
|
|
|
|
springStiffness: 100, // Faster animation = faster tests
|
|
|
|
showRotationControl: true
|
|
|
|
});
|
|
|
|
viewer.addHandler('open', openHandler);
|
|
|
|
viewer.open('/test/data/testpattern.dzi');
|
|
|
|
});
|
|
|
|
|
2017-12-05 05:41:08 +03:00
|
|
|
QUnit.test('SequenceControlOff', function (assert) {
|
|
|
|
var done = assert.async();
|
2014-04-07 22:11:33 +04:00
|
|
|
var openHandler = function () {
|
|
|
|
viewer.removeHandler('open', openHandler);
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.ok(!viewer.showSequenceControl, 'showSequenceControl should be off');
|
|
|
|
assert.ok(!viewer.previousButton, "Previous button should be null");
|
|
|
|
assert.ok(!viewer.nextButton, "Next button should be null");
|
2014-04-07 22:11:33 +04:00
|
|
|
|
|
|
|
viewer.close();
|
2017-12-05 05:41:08 +03:00
|
|
|
done();
|
2014-04-07 22:11:33 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
viewer = OpenSeadragon({
|
|
|
|
id: 'controlsTests',
|
|
|
|
prefixUrl: '/build/openseadragon/images/',
|
|
|
|
tileSources: [
|
|
|
|
'/test/data/testpattern.dzi',
|
|
|
|
'/test/data/testpattern.dzi',
|
|
|
|
'/test/data/testpattern.dzi'
|
|
|
|
],
|
|
|
|
springStiffness: 100, // Faster animation = faster tests
|
|
|
|
showSequenceControl: false
|
|
|
|
});
|
|
|
|
viewer.addHandler('open', openHandler);
|
|
|
|
});
|
|
|
|
|
2017-12-05 05:41:08 +03:00
|
|
|
QUnit.test('SequenceControlOnPrevNextWrapOff', function (assert) {
|
|
|
|
var done = assert.async();
|
2014-04-07 22:11:33 +04:00
|
|
|
var openHandler = function () {
|
|
|
|
viewer.removeHandler('open', openHandler);
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.ok(viewer.showSequenceControl, 'showSequenceControl should be on');
|
|
|
|
assert.ok(!!viewer.previousButton, "Previous button should not be null");
|
|
|
|
assert.ok(!!viewer.nextButton, "Next button should not be null");
|
|
|
|
assert.notEqual(viewer.paging.buttons.indexOf(viewer.previousButton), -1,
|
2014-04-07 22:11:33 +04:00
|
|
|
"The previous button should be present");
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.notEqual(viewer.paging.buttons.indexOf(viewer.nextButton), -1,
|
2014-04-07 22:11:33 +04:00
|
|
|
"The next button should be present");
|
|
|
|
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.equal(viewer.currentPage(), 0, "OSD should open on first page.");
|
|
|
|
assert.ok(viewer.previousButton.element.disabled,
|
2014-04-07 22:11:33 +04:00
|
|
|
"Previous should be disabled on first page.");
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.ok(!viewer.nextButton.element.disabled,
|
2014-04-07 22:11:33 +04:00
|
|
|
"Next should be enabled on first page.");
|
|
|
|
|
|
|
|
viewer.nextButton.onRelease();
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.equal(viewer.currentPage(), 1, "OSD should be on second page.");
|
|
|
|
assert.ok(!viewer.previousButton.element.disabled,
|
2014-04-07 22:11:33 +04:00
|
|
|
"Previous should be enabled on second page.");
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.ok(!viewer.nextButton.element.disabled,
|
2014-04-07 22:11:33 +04:00
|
|
|
"Next should be enabled on second page.");
|
|
|
|
|
|
|
|
viewer.nextButton.onRelease();
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.equal(viewer.currentPage(), 2, "OSD should be on third page.");
|
|
|
|
assert.ok(!viewer.previousButton.element.disabled,
|
2014-04-07 22:11:33 +04:00
|
|
|
"Previous should be enabled on third page.");
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.ok(viewer.nextButton.element.disabled,
|
2014-04-07 22:11:33 +04:00
|
|
|
"Next should be disabled on third page.");
|
|
|
|
|
|
|
|
viewer.previousButton.onRelease();
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.equal(viewer.currentPage(), 1, "OSD should be on second page.");
|
|
|
|
assert.ok(!viewer.previousButton.element.disabled,
|
2014-04-07 22:11:33 +04:00
|
|
|
"Previous should be enabled on second page.");
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.ok(!viewer.nextButton.element.disabled,
|
2014-04-07 22:11:33 +04:00
|
|
|
"Next should be enabled on second page.");
|
|
|
|
|
|
|
|
viewer.close();
|
2017-12-05 05:41:08 +03:00
|
|
|
done();
|
2014-04-07 22:11:33 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
viewer = OpenSeadragon({
|
|
|
|
id: 'controlsTests',
|
|
|
|
prefixUrl: '/build/openseadragon/images/',
|
|
|
|
tileSources: [
|
|
|
|
'/test/data/testpattern.dzi',
|
|
|
|
'/test/data/testpattern.dzi',
|
|
|
|
'/test/data/testpattern.dzi'
|
|
|
|
],
|
|
|
|
springStiffness: 100, // Faster animation = faster tests
|
|
|
|
showSequenceControl: true,
|
2014-11-18 01:06:10 +03:00
|
|
|
sequenceMode: true,
|
2014-04-07 22:11:33 +04:00
|
|
|
navPrevNextWrap: false
|
|
|
|
});
|
|
|
|
viewer.addHandler('open', openHandler);
|
|
|
|
});
|
|
|
|
|
2017-12-05 05:41:08 +03:00
|
|
|
QUnit.test('SequenceControlOnPrevNextWrapOn', function (assert) {
|
|
|
|
var done = assert.async();
|
2014-04-07 22:11:33 +04:00
|
|
|
var openHandler = function () {
|
|
|
|
viewer.removeHandler('open', openHandler);
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.ok(viewer.showSequenceControl, 'showSequenceControl should be on');
|
|
|
|
assert.ok(!!viewer.previousButton, "Previous button should not be null");
|
|
|
|
assert.ok(!!viewer.nextButton, "Next button should not be null");
|
|
|
|
assert.notEqual(viewer.paging.buttons.indexOf(viewer.previousButton), -1,
|
2014-04-07 22:11:33 +04:00
|
|
|
"The previous button should be present");
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.notEqual(viewer.paging.buttons.indexOf(viewer.nextButton), -1,
|
2014-04-07 22:11:33 +04:00
|
|
|
"The next button should be present");
|
|
|
|
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.equal(viewer.currentPage(), 0, "OSD should open on first page.");
|
|
|
|
assert.ok(!viewer.previousButton.element.disabled,
|
2014-04-07 22:11:33 +04:00
|
|
|
"Previous should be enabled on first page.");
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.ok(!viewer.nextButton.element.disabled,
|
2014-04-07 22:11:33 +04:00
|
|
|
"Next should be enabled on first page.");
|
|
|
|
|
|
|
|
viewer.previousButton.onRelease();
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.equal(viewer.currentPage(), 2, "OSD should be on third page.");
|
|
|
|
assert.ok(!viewer.previousButton.element.disabled,
|
2014-04-07 22:11:33 +04:00
|
|
|
"Previous should be enabled on third page.");
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.ok(!viewer.nextButton.element.disabled,
|
2014-04-07 22:11:33 +04:00
|
|
|
"Next should be enabled on third page.");
|
|
|
|
|
|
|
|
viewer.nextButton.onRelease();
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.equal(viewer.currentPage(), 0, "OSD should be on first page.");
|
|
|
|
assert.ok(!viewer.previousButton.element.disabled,
|
2014-04-07 22:11:33 +04:00
|
|
|
"Previous should be enabled on first page.");
|
2017-12-05 05:41:08 +03:00
|
|
|
assert.ok(!viewer.nextButton.element.disabled,
|
2014-04-07 22:11:33 +04:00
|
|
|
"Next should be enabled on first page.");
|
|
|
|
|
|
|
|
viewer.close();
|
2017-12-05 05:41:08 +03:00
|
|
|
done();
|
2014-04-07 22:11:33 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
viewer = OpenSeadragon({
|
|
|
|
id: 'controlsTests',
|
|
|
|
prefixUrl: '/build/openseadragon/images/',
|
|
|
|
tileSources: [
|
|
|
|
'/test/data/testpattern.dzi',
|
|
|
|
'/test/data/testpattern.dzi',
|
|
|
|
'/test/data/testpattern.dzi'
|
|
|
|
],
|
|
|
|
springStiffness: 100, // Faster animation = faster tests
|
|
|
|
showSequenceControl: true,
|
2014-11-18 01:06:10 +03:00
|
|
|
sequenceMode: true,
|
2014-04-07 22:11:33 +04:00
|
|
|
navPrevNextWrap: true
|
|
|
|
});
|
|
|
|
viewer.addHandler('open', openHandler);
|
|
|
|
});
|
|
|
|
|
|
|
|
})();
|