mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 06:36:11 +03:00
51 lines
1.4 KiB
JavaScript
51 lines
1.4 KiB
JavaScript
(function() {
|
|
|
|
module('DZI JSONp');
|
|
|
|
var viewer = null;
|
|
|
|
// ----------
|
|
asyncTest('Open', function() {
|
|
$(document).ready(function() {
|
|
var timeWatcher = Util.timeWatcher();
|
|
|
|
viewer = OpenSeadragon({
|
|
id: 'example',
|
|
prefixUrl: '/build/openseadragon/images/',
|
|
tileSources: '/test/data/testpattern.js'
|
|
});
|
|
|
|
ok(viewer, 'Viewer exists');
|
|
|
|
var openHandler = function(eventSender, eventData) {
|
|
viewer.removeHandler('open', openHandler);
|
|
ok(true, 'Open event was sent');
|
|
viewer.drawer.viewer = viewer;
|
|
viewer.addHandler('tile-drawn', tileDrawnHandler);
|
|
};
|
|
|
|
var tileDrawnHandler = function(eventSender, eventData) {
|
|
viewer.removeHandler('tile-drawn', tileDrawnHandler);
|
|
ok(true, 'A tile has been drawn');
|
|
timeWatcher.done();
|
|
};
|
|
|
|
viewer.addHandler('open', openHandler);
|
|
});
|
|
});
|
|
|
|
// ----------
|
|
asyncTest('Close', function() {
|
|
var closeHandler = function() {
|
|
viewer.removeHandler('close', closeHandler);
|
|
$('#example').empty();
|
|
ok(true, 'Close event was sent');
|
|
start();
|
|
};
|
|
|
|
viewer.addHandler('close', closeHandler);
|
|
viewer.close();
|
|
});
|
|
|
|
})();
|