2013-05-09 22:03:31 +04:00
|
|
|
(function() {
|
|
|
|
|
2013-05-13 21:50:43 +04:00
|
|
|
// This module tests whether our various file formats can be opened.
|
|
|
|
// TODO: Add more file formats (with corresponding test data).
|
|
|
|
|
2013-07-02 02:17:45 +04:00
|
|
|
module('Formats', {
|
|
|
|
setup: function () {
|
|
|
|
var example = document.createElement("div");
|
|
|
|
example.id = "example";
|
|
|
|
document.getElementById("qunit-fixture").appendChild(example);
|
|
|
|
}
|
|
|
|
});
|
2013-05-09 22:03:31 +04:00
|
|
|
|
|
|
|
var viewer = null;
|
|
|
|
|
|
|
|
// ----------
|
2013-05-13 21:50:43 +04:00
|
|
|
var testOpen = function(name) {
|
2013-05-09 22:03:31 +04:00
|
|
|
$(document).ready(function() {
|
2013-05-18 06:29:08 +04:00
|
|
|
var timeWatcher = Util.timeWatcher(7000);
|
2013-05-10 22:53:49 +04:00
|
|
|
|
2013-05-09 22:03:31 +04:00
|
|
|
viewer = OpenSeadragon({
|
|
|
|
id: 'example',
|
|
|
|
prefixUrl: '/build/openseadragon/images/',
|
2013-05-13 21:50:43 +04:00
|
|
|
tileSources: '/test/data/' + name
|
2013-05-09 22:03:31 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
ok(viewer, 'Viewer exists');
|
|
|
|
|
2013-10-11 04:00:15 +04:00
|
|
|
var openHandler = function(event) {
|
2013-05-09 22:03:31 +04:00
|
|
|
viewer.removeHandler('open', openHandler);
|
|
|
|
ok(true, 'Open event was sent');
|
|
|
|
viewer.addHandler('tile-drawn', tileDrawnHandler);
|
|
|
|
};
|
|
|
|
|
2013-10-11 04:00:15 +04:00
|
|
|
var tileDrawnHandler = function(event) {
|
2013-05-09 22:03:31 +04:00
|
|
|
viewer.removeHandler('tile-drawn', tileDrawnHandler);
|
|
|
|
ok(true, 'A tile has been drawn');
|
2013-05-13 21:50:43 +04:00
|
|
|
viewer.addHandler('close', closeHandler);
|
|
|
|
viewer.close();
|
|
|
|
};
|
|
|
|
|
2013-10-11 04:00:15 +04:00
|
|
|
var closeHandler = function(event) {
|
2013-05-13 21:50:43 +04:00
|
|
|
viewer.removeHandler('close', closeHandler);
|
|
|
|
$('#example').empty();
|
|
|
|
ok(true, 'Close event was sent');
|
2013-05-10 22:53:49 +04:00
|
|
|
timeWatcher.done();
|
2013-05-09 22:03:31 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
viewer.addHandler('open', openHandler);
|
|
|
|
});
|
2013-05-13 21:50:43 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
// ----------
|
|
|
|
asyncTest('DZI', function() {
|
|
|
|
testOpen('testpattern.dzi');
|
2013-05-09 22:03:31 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
// ----------
|
2013-05-13 21:50:43 +04:00
|
|
|
asyncTest('DZI JSONp', function() {
|
|
|
|
testOpen('testpattern.js');
|
2013-05-10 22:32:43 +04:00
|
|
|
});
|
2013-05-13 21:50:43 +04:00
|
|
|
|
|
|
|
// ----------
|
|
|
|
asyncTest('DZI XML', function() {
|
|
|
|
testOpen('testpattern.xml');
|
|
|
|
});
|
|
|
|
|
2013-09-27 01:24:02 +04:00
|
|
|
// ----------
|
2014-04-11 00:08:19 +04:00
|
|
|
asyncTest('DZI XML with query parameter', function() {
|
|
|
|
testOpen('testpattern.xml?param=value');
|
|
|
|
});
|
|
|
|
|
|
|
|
// ----------
|
2013-10-01 03:42:16 +04:00
|
|
|
asyncTest('IIIF 1.0 JSON', function() {
|
2014-07-28 22:53:06 +04:00
|
|
|
testOpen('iiif_1_0_files/info.json');
|
2013-09-27 01:24:02 +04:00
|
|
|
});
|
|
|
|
|
2013-10-01 03:42:16 +04:00
|
|
|
// ----------
|
|
|
|
asyncTest('IIIF 1.0 XML', function() {
|
2014-07-28 22:53:06 +04:00
|
|
|
testOpen('iiif_1_0_files/info.xml');
|
2013-10-01 03:42:16 +04:00
|
|
|
});
|
2013-09-27 01:24:02 +04:00
|
|
|
|
2013-10-01 03:42:16 +04:00
|
|
|
// ----------
|
|
|
|
asyncTest('IIIF 1.1 JSON', function() {
|
2014-07-28 22:53:06 +04:00
|
|
|
testOpen('iiif_1_1_tiled/info.json');
|
2013-10-01 03:42:16 +04:00
|
|
|
});
|
2013-09-27 01:24:02 +04:00
|
|
|
|
2014-01-03 04:59:10 +04:00
|
|
|
// ----------
|
|
|
|
asyncTest('IIIF No Tiles, Less than 256', function() {
|
2014-07-28 22:53:06 +04:00
|
|
|
testOpen('iiif_1_1_no_tiles_255/info.json');
|
2014-01-03 04:59:10 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
// ----------
|
|
|
|
asyncTest('IIIF No Tiles, Bet. 256 and 512', function() {
|
2014-07-28 22:53:06 +04:00
|
|
|
testOpen('iiif_1_1_no_tiles_384/info.json');
|
2014-01-03 04:59:10 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
// ----------
|
|
|
|
asyncTest('IIIF No Tiles, Bet. 512 and 1024', function() {
|
2014-07-28 22:53:06 +04:00
|
|
|
testOpen('iiif_1_1_no_tiles_768/info.json');
|
2014-01-03 04:59:10 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
// ----------
|
|
|
|
asyncTest('IIIF No Tiles, Larger than 1024', function() {
|
2014-07-28 22:53:06 +04:00
|
|
|
testOpen('iiif_1_1_no_tiles_1048/info.json');
|
2013-11-18 21:52:55 +04:00
|
|
|
});
|
|
|
|
|
2014-07-28 23:45:52 +04:00
|
|
|
// ----------
|
|
|
|
asyncTest('IIIF 2.0 JSON', function() {
|
|
|
|
testOpen('iiif_2_0_tiled/info.json');
|
2015-06-11 17:49:32 +03:00
|
|
|
});
|
2014-07-28 23:45:52 +04:00
|
|
|
|
2013-05-09 22:03:31 +04:00
|
|
|
})();
|