openseadragon/test/dzi-jsonp.js

51 lines
1.4 KiB
JavaScript
Raw Normal View History

(function() {
module('DZI JSONp');
var viewer = null;
// ----------
asyncTest('Open', function() {
$(document).ready(function() {
2013-05-10 22:53:49 +04:00
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');
2013-05-10 22:53:49 +04:00
timeWatcher.done();
};
viewer.addHandler('open', openHandler);
});
});
// ----------
2013-05-10 22:32:43 +04:00
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();
});
})();