diff --git a/test/data/testpattern.xml b/test/data/testpattern.xml new file mode 100644 index 00000000..6d93c763 --- /dev/null +++ b/test/data/testpattern.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/test/dzi-jsonp.js b/test/formats.js similarity index 54% rename from test/dzi-jsonp.js rename to test/formats.js index 08b7da22..23ef1cc4 100644 --- a/test/dzi-jsonp.js +++ b/test/formats.js @@ -1,18 +1,21 @@ (function() { - module('DZI JSONp'); + // This module tests whether our various file formats can be opened. + // TODO: Add more file formats (with corresponding test data). + + module('Formats'); var viewer = null; // ---------- - asyncTest('Open', function() { + var testOpen = function(name) { $(document).ready(function() { var timeWatcher = Util.timeWatcher(); viewer = OpenSeadragon({ id: 'example', prefixUrl: '/build/openseadragon/images/', - tileSources: '/test/data/testpattern.js' + tileSources: '/test/data/' + name }); ok(viewer, 'Viewer exists'); @@ -27,24 +30,34 @@ var tileDrawnHandler = function(eventSender, eventData) { viewer.removeHandler('tile-drawn', tileDrawnHandler); ok(true, 'A tile has been drawn'); + viewer.addHandler('close', closeHandler); + viewer.close(); + }; + + var closeHandler = function() { + viewer.removeHandler('close', closeHandler); + $('#example').empty(); + ok(true, 'Close event was sent'); timeWatcher.done(); }; viewer.addHandler('open', openHandler); }); + }; + + // ---------- + asyncTest('DZI', function() { + testOpen('testpattern.dzi'); }); // ---------- - 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(); + asyncTest('DZI JSONp', function() { + testOpen('testpattern.js'); }); - + + // ---------- + asyncTest('DZI XML', function() { + testOpen('testpattern.xml'); + }); + })(); diff --git a/test/test.html b/test/test.html index 92344f56..e34f8bd0 100644 --- a/test/test.html +++ b/test/test.html @@ -17,6 +17,6 @@ - +