Generalized format test and added DZI XML

This commit is contained in:
Ian Gilman 2013-05-13 10:50:43 -07:00
parent 4182b5e5ba
commit 9001fe9a5e
3 changed files with 29 additions and 15 deletions

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><Image TileSize="254" Overlap="1" Format="jpg" xmlns="http://schemas.microsoft.com/deepzoom/2008"><Size Width="1000" Height="1000"/></Image>

View File

@ -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();
};
asyncTest('DZI JSONp', function() {
testOpen('testpattern.js');
});
viewer.addHandler('close', closeHandler);
viewer.close();
// ----------
asyncTest('DZI XML', function() {
testOpen('testpattern.xml');
});
})();

View File

@ -17,6 +17,6 @@
<script src="/test/util.js"></script>
<script src="/test/basic.js"></script>
<script src="/test/strings.js"></script>
<script src="/test/dzi-jsonp.js"></script>
<script src="/test/formats.js"></script>
</body>
</html>