mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-02-07 18:39:23 +03:00
Change the fitBoundsWithConstraints test according to feedback (I think)
This commit is contained in:
parent
8ce77c51fb
commit
ed0ffb14cf
@ -362,18 +362,35 @@
|
|||||||
viewer.open(DZI_PATH);
|
viewer.open(DZI_PATH);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var testRectsOutsideImage = [
|
||||||
|
new OpenSeadragon.Rect(0, 0, 2000, 100),
|
||||||
|
new OpenSeadragon.Rect(0, 0, 2000, 100),
|
||||||
|
new OpenSeadragon.Rect(800, 800, 300, 300),
|
||||||
|
new OpenSeadragon.Rect(-40, -40, 500, 500)
|
||||||
|
];
|
||||||
|
|
||||||
|
// Why is it always this!?
|
||||||
|
var expectedRectFitBounds = new OpenSeadragon.Rect(
|
||||||
|
-0.05555555555555558,
|
||||||
|
-0.05555555555555558,
|
||||||
|
1.1111111111111112,
|
||||||
|
1.1111111111111112
|
||||||
|
);
|
||||||
|
|
||||||
asyncTest('fitBoundsWithConstraints', function(){
|
asyncTest('fitBoundsWithConstraints', function(){
|
||||||
var openHandler = function(event) {
|
var openHandler = function(event) {
|
||||||
viewer.removeHandler('open', openHandler);
|
viewer.removeHandler('open', openHandler);
|
||||||
var viewport = viewer.viewport;
|
var viewport = viewer.viewport;
|
||||||
|
viewport.zoomTo(ZOOM_FACTOR, null, true);
|
||||||
|
viewport.update();
|
||||||
|
for(var i = 0; i < testRectsOutsideImage.length; i++){
|
||||||
|
var rect = testRectsOutsideImage[i];
|
||||||
|
|
||||||
for(var i = 0; i < testRects.length; i++){
|
|
||||||
var rect = testRects[i].times(viewport.getContainerSize());
|
|
||||||
viewport.fitBoundsWithConstraints(rect, true);
|
viewport.fitBoundsWithConstraints(rect, true);
|
||||||
viewport.update();
|
viewport.update();
|
||||||
propEqual(
|
propEqual(
|
||||||
viewport.getBounds(),
|
viewport.getBounds(),
|
||||||
rect,
|
expectedRectFitBounds,
|
||||||
"Fit bounds correctly."
|
"Fit bounds correctly."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user