Added tests for rotate control on/off setting.

This commit is contained in:
Grant Echols 2014-03-03 14:45:30 -07:00
parent 5e0e8005d6
commit e368bd50aa
3 changed files with 81 additions and 0 deletions

View File

@ -798,6 +798,18 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
HOVER: 'fullpage_hover.png',
DOWN: 'fullpage_pressed.png'
},
rotateleft: {
REST: 'rotateleft_rest.png',
GROUP: 'rotateleft_grouphover.png',
HOVER: 'rotateleft_hover.png',
DOWN: 'rotateleft_pressed.png'
},
rotateright: {
REST: 'rotateright_rest.png',
GROUP: 'rotateright_grouphover.png',
HOVER: 'rotateright_hover.png',
DOWN: 'rotateright_pressed.png'
},
previous: {
REST: 'previous_rest.png',
GROUP: 'previous_grouphover.png',

68
test/rotate.js Normal file
View File

@ -0,0 +1,68 @@
/* global module, asyncTest, $, ok, equal, notEqual, start, test, Util, testLog */
(function () {
var viewer;
module('Basic', {
setup: function () {
var example = $('<div id="rotateTests"></div>').appendTo("#qunit-fixture");
testLog.reset();
},
teardown: function () {
if (viewer && viewer.close) {
viewer.close();
}
viewer = null;
}
});
asyncTest('RotateControlOff', function () {
var openHandler = function (event) {
viewer.removeHandler('open', openHandler);
ok(true, 'Open event was sent');
ok(viewer.drawer, 'Drawer exists');
ok(viewer.drawer.canRotate(), 'drawer.canRotate is true');
ok(!viewer.showRotationControl, 'showRotationControl is on - default should be off');
ok(!viewer.rotateLeft, "rotateLeft button should be null");
ok(!viewer.rotateRight, "rotateRight button should be null");
start();
};
viewer = OpenSeadragon({
id: 'rotateTests',
prefixUrl: '/build/openseadragon/images/',
springStiffness: 100, // Faster animation = faster tests
showRotationControl: false
});
viewer.addHandler('open', openHandler);
viewer.open('/test/data/testpattern.dzi');
});
asyncTest('RotateControlOn', function () {
var openHandler = function (event) {
viewer.removeHandler('open', openHandler);
ok(true, 'Open event was sent');
ok(viewer.drawer, 'Drawer exists');
ok(viewer.drawer.canRotate(), 'drawer.canRotate is true');
ok(viewer.showRotationControl, 'showRotationControl is on');
ok(-1 != viewer.buttons.buttons.indexOf(viewer.rotateLeft), "rotateLeft not found");
ok(-1 != viewer.buttons.buttons.indexOf(viewer.rotateRight), "rotateRight not found");
start();
};
viewer = OpenSeadragon({
id: 'rotateTests',
prefixUrl: '/build/openseadragon/images/',
springStiffness: 100, // Faster animation = faster tests
showRotationControl: true
});
viewer.addHandler('open', openHandler);
viewer.open('/test/data/testpattern.dzi');
});
})();

View File

@ -27,5 +27,6 @@
<script src="/test/utils.js"></script>
<script src="/test/events.js"></script>
<script src="/test/units.js"></script>
<script src="/test/rotate.js"></script>
</body>
</html>