mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-21 20:56:09 +03:00
Generalized format test and added DZI XML
This commit is contained in:
parent
4182b5e5ba
commit
9001fe9a5e
1
test/data/testpattern.xml
Normal file
1
test/data/testpattern.xml
Normal 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>
|
@ -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');
|
||||
});
|
||||
|
||||
})();
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user