mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-04-03 05:43:30 +03:00
Tests for getRelativeSize
This commit is contained in:
parent
11ef3fcfbb
commit
45bdd87224
1 changed files with 15 additions and 1 deletions
|
@ -41,8 +41,11 @@
|
||||||
viewer.addHandler('open', function(event) {
|
viewer.addHandler('open', function(event) {
|
||||||
var image = viewer.world.getItemAt(0);
|
var image = viewer.world.getItemAt(0);
|
||||||
var contentSize = image.getContentSize();
|
var contentSize = image.getContentSize();
|
||||||
|
var relativeSize = image.getRelativeSize();
|
||||||
assert.equal(contentSize.x, 500, 'contentSize.x');
|
assert.equal(contentSize.x, 500, 'contentSize.x');
|
||||||
assert.equal(contentSize.y, 2000, 'contentSize.y');
|
assert.equal(contentSize.y, 2000, 'contentSize.y');
|
||||||
|
assert.equal(relativeSize.x, 12.5, 'relativeSize.x');
|
||||||
|
assert.equal(relativeSize.y, 50, 'relativeSize.y');
|
||||||
|
|
||||||
checkBounds(assert, image, new OpenSeadragon.Rect(5, 6, 10, 40), 'initial bounds');
|
checkBounds(assert, image, new OpenSeadragon.Rect(5, 6, 10, 40), 'initial bounds');
|
||||||
|
|
||||||
|
@ -74,7 +77,18 @@
|
||||||
image.setHeight(4);
|
image.setHeight(4);
|
||||||
checkBounds(assert, image, new OpenSeadragon.Rect(7, 8, 1, 4), 'bounds after width');
|
checkBounds(assert, image, new OpenSeadragon.Rect(7, 8, 1, 4), 'bounds after width');
|
||||||
|
|
||||||
assert.equal(handlerCount, 1, 'correct number of handlers called');
|
viewer.addHandler('zoom', function zoomHandler(event) {
|
||||||
|
var relativeSize = image.getRelativeSize();
|
||||||
|
viewer.removeHandler('zoom', zoomHandler);
|
||||||
|
handlerCount++;
|
||||||
|
assert.equal(relativeSize.x, 4000, 'relativeSize.x after zoom');
|
||||||
|
assert.equal(relativeSize.y, 16000, 'relativeSize.y after zoom');
|
||||||
|
});
|
||||||
|
|
||||||
|
viewer.viewport.zoomTo(8);
|
||||||
|
|
||||||
|
assert.equal(handlerCount, 2, 'correct number of handlers called');
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue