update unit tests

This commit is contained in:
Tom 2022-12-02 22:08:15 -05:00
parent 5aca85fe21
commit 78c6295acf
2 changed files with 5 additions and 4 deletions

View File

@ -577,10 +577,11 @@ $.Viewport.prototype = {
} }
var newViewportBounds = this.viewerElementToViewportRectangle(newBounds); var constraintApplied = xConstrained || yConstrained;
var newViewportBounds = constraintApplied ? this.viewerElementToViewportRectangle(newBounds) : bounds.clone();
newViewportBounds.xConstrained = xConstrained; newViewportBounds.xConstrained = xConstrained;
newViewportBounds.yConstrained = yConstrained; newViewportBounds.yConstrained = yConstrained;
newViewportBounds.constraintApplied = xConstrained || yConstrained; newViewportBounds.constraintApplied = constraintApplied;
return newViewportBounds; return newViewportBounds;
}, },

View File

@ -539,7 +539,7 @@
var bounds = viewport.getBounds(); var bounds = viewport.getBounds();
Util.assertRectangleEquals( Util.assertRectangleEquals(
assert, assert,
new OpenSeadragon.Rect(1.2071067811865466, 0.20710678118654746, Math.sqrt(2), Math.sqrt(2), 45), new OpenSeadragon.Rect(1.0, 0.0, Math.sqrt(2), Math.sqrt(2), 45),
bounds, bounds,
EPSILON, EPSILON,
"Viewport.applyConstraints with rotation should move viewport."); "Viewport.applyConstraints with rotation should move viewport.");
@ -564,7 +564,7 @@
var bounds = viewport.getBounds(); var bounds = viewport.getBounds();
Util.assertRectangleEquals( Util.assertRectangleEquals(
assert, assert,
new OpenSeadragon.Rect(1.2071067811865466, 0.20710678118654746, Math.sqrt(2), Math.sqrt(2), 45), new OpenSeadragon.Rect(1.0, 0.0, Math.sqrt(2), Math.sqrt(2), 45),
bounds, bounds,
EPSILON, EPSILON,
"Viewport.applyConstraints flipped and with rotation should move viewport."); "Viewport.applyConstraints flipped and with rotation should move viewport.");