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() { (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; var viewer = null;
// ---------- // ----------
asyncTest('Open', function() { var testOpen = function(name) {
$(document).ready(function() { $(document).ready(function() {
var timeWatcher = Util.timeWatcher(); var timeWatcher = Util.timeWatcher();
viewer = OpenSeadragon({ viewer = OpenSeadragon({
id: 'example', id: 'example',
prefixUrl: '/build/openseadragon/images/', prefixUrl: '/build/openseadragon/images/',
tileSources: '/test/data/testpattern.js' tileSources: '/test/data/' + name
}); });
ok(viewer, 'Viewer exists'); ok(viewer, 'Viewer exists');
@ -27,24 +30,34 @@
var tileDrawnHandler = function(eventSender, eventData) { var tileDrawnHandler = function(eventSender, eventData) {
viewer.removeHandler('tile-drawn', tileDrawnHandler); viewer.removeHandler('tile-drawn', tileDrawnHandler);
ok(true, 'A tile has been drawn'); 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(); timeWatcher.done();
}; };
viewer.addHandler('open', openHandler); viewer.addHandler('open', openHandler);
}); });
};
// ----------
asyncTest('DZI', function() {
testOpen('testpattern.dzi');
}); });
// ---------- // ----------
asyncTest('Close', function() { asyncTest('DZI JSONp', function() {
var closeHandler = function() { testOpen('testpattern.js');
viewer.removeHandler('close', closeHandler);
$('#example').empty();
ok(true, 'Close event was sent');
start();
};
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/util.js"></script>
<script src="/test/basic.js"></script> <script src="/test/basic.js"></script>
<script src="/test/strings.js"></script> <script src="/test/strings.js"></script>
<script src="/test/dzi-jsonp.js"></script> <script src="/test/formats.js"></script>
</body> </body>
</html> </html>