Test that shows the bug #890, fails

This commit is contained in:
Victor Rodriguez Gil 2016-06-13 23:04:55 +00:00
parent 755d8f01d0
commit 0035b3f36f

View File

@ -437,8 +437,8 @@
viewport.applyConstraints(true); viewport.applyConstraints(true);
var bounds = viewport.getBounds(); var bounds = viewport.getBounds();
Util.assertRectangleEquals( Util.assertRectangleEquals(
bounds,
new OpenSeadragon.Rect(0.7, 0.7, 1, 1), new OpenSeadragon.Rect(0.7, 0.7, 1, 1),
bounds,
EPSILON, EPSILON,
"Viewport.applyConstraints should move viewport."); "Viewport.applyConstraints should move viewport.");
start(); start();
@ -447,6 +447,27 @@
viewer.open(DZI_PATH); viewer.open(DZI_PATH);
}); });
asyncTest('applyConstraints with visibilityRatio = 1 shouldn\'t bounce around', function() {
var openHandler = function() {
viewer.removeHandler('open', openHandler);
var viewport = viewer.viewport;
viewport.visibilityRatio = 1;
viewport.zoomTo(0.5, undefined, true);
viewport.panBy(new OpenSeadragon.Point(0.75, 0), true);
viewport.applyConstraints(true);
var bounds = viewport.getBounds();
Util.assertRectangleEquals(
new OpenSeadragon.Rect(-0.5, 1, 2, 2),
bounds,
EPSILON,
"Viewport.applyConstraints should move viewport to the center, not to a side.");
start();
};
viewer.addHandler('open', openHandler);
viewer.open(TALL_PATH);
});
asyncTest('applyConstraints with rotation', function() { asyncTest('applyConstraints with rotation', function() {
var openHandler = function() { var openHandler = function() {
viewer.removeHandler('open', openHandler); viewer.removeHandler('open', openHandler);