mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-21 20:56:09 +03:00
Adds tests about flip methods
This commit is contained in:
parent
43d3949dd1
commit
a31587df2f
@ -881,7 +881,6 @@ $.Viewport.prototype = {
|
||||
if (!this.viewer || !this.viewer.drawer.canRotate()) {
|
||||
return this;
|
||||
}
|
||||
|
||||
this.degrees = $.positiveModulo(degrees, 360);
|
||||
this._setContentBounds(
|
||||
this.viewer.world.getHomeBounds(),
|
||||
@ -1531,7 +1530,6 @@ $.Viewport.prototype = {
|
||||
return this;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Gets flip state stored on viewport.
|
||||
* @function
|
||||
@ -1541,7 +1539,6 @@ $.Viewport.prototype = {
|
||||
return this.flipped;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Sets flip state according to the state input argument.
|
||||
* @function
|
||||
|
@ -1140,4 +1140,43 @@
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test('toggleFlipState', function(assert) {
|
||||
var done = assert.async();
|
||||
var openHandler = function(event) {
|
||||
viewer.removeHandler('open', openHandler);
|
||||
var viewport = viewer.viewport;
|
||||
|
||||
assert.deepEqual(viewport.getFlip(), false, "Get original flip state should be false");
|
||||
|
||||
viewport.toggleFlip();
|
||||
assert.deepEqual(viewport.getFlip(), true, "Toggling flip state variable, viewport should be true");
|
||||
|
||||
viewport.toggleFlip();
|
||||
assert.deepEqual(viewport.getFlip(), false, "Toggling back flip state variable, viewport should be false again");
|
||||
|
||||
done();
|
||||
};
|
||||
viewer.addHandler('open', openHandler);
|
||||
viewer.open(DZI_PATH);
|
||||
});
|
||||
|
||||
QUnit.test('setFlipState', function(assert) {
|
||||
var done = assert.async();
|
||||
var openHandler = function(event) {
|
||||
viewer.removeHandler('open', openHandler);
|
||||
var viewport = viewer.viewport;
|
||||
|
||||
assert.deepEqual(viewport.getFlip(), false, "Get original flip state should be false");
|
||||
|
||||
viewport.setFlip(true);
|
||||
assert.deepEqual(viewport.getFlip(), true, "Setting flip state variable should be true");
|
||||
|
||||
viewport.setFlip(false);
|
||||
assert.deepEqual(viewport.getFlip(), false, "Unsetting flip state variable, viewport should be false again");
|
||||
|
||||
done();
|
||||
};
|
||||
viewer.addHandler('open', openHandler);
|
||||
viewer.open(DZI_PATH);
|
||||
});
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user