mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-02-12 12:59:23 +03:00
Getting into alignment with code style guidelines
This commit is contained in:
parent
b3d358fa35
commit
df3344f67c
@ -54,7 +54,7 @@ $.Navigator = function( options ){
|
|||||||
|
|
||||||
options.minPixelRatio = this.minPixelRatio = viewer.minPixelRatio;
|
options.minPixelRatio = this.minPixelRatio = viewer.minPixelRatio;
|
||||||
|
|
||||||
this.viewerDimensionsInPoints = viewer.viewport.deltaPointsFromPixels($.getElementSize( viewer.element));
|
this.viewerSizeInPoints = viewer.viewport.deltaPointsFromPixels(viewerSize);
|
||||||
this.borderWidth = 2;
|
this.borderWidth = 2;
|
||||||
//At some browser magnification levels the display regions lines up correctly, but at some there appears to
|
//At some browser magnification levels the display regions lines up correctly, but at some there appears to
|
||||||
//be a one pixel gap.
|
//be a one pixel gap.
|
||||||
@ -208,24 +208,23 @@ $.extend( $.Navigator.prototype, $.EventHandler.prototype, $.Viewer.prototype, {
|
|||||||
*/
|
*/
|
||||||
function onCanvasClick( tracker, position, quick, shift ) {
|
function onCanvasClick( tracker, position, quick, shift ) {
|
||||||
var newBounds,
|
var newBounds,
|
||||||
positionInPoints,
|
viewerPosition,
|
||||||
dimensionsInPoints,
|
dimensions;
|
||||||
contentAspectRatio = this.viewer.source.dimensions.x / this.viewer.source.dimensions.y;
|
|
||||||
if (! this.drag) {
|
if (! this.drag) {
|
||||||
if ( this.viewer.viewport ) {
|
if ( this.viewer.viewport ) {
|
||||||
positionInPoints = this.viewport.deltaPointsFromPixels(position);
|
viewerPosition = this.viewport.deltaPointsFromPixels(position);
|
||||||
dimensionsInPoints = this.viewer.viewport.getBounds().getSize();
|
dimensions = this.viewer.viewport.getBounds().getSize();
|
||||||
newBounds = new $.Rect(
|
newBounds = new $.Rect(
|
||||||
positionInPoints.x - dimensionsInPoints.x/2,
|
viewerPosition.x - dimensions.x/2,
|
||||||
positionInPoints.y - dimensionsInPoints.y/2,
|
viewerPosition.y - dimensions.y/2,
|
||||||
dimensionsInPoints.x,
|
dimensions.x,
|
||||||
dimensionsInPoints.y
|
dimensions.y
|
||||||
);
|
);
|
||||||
if (contentAspectRatio > this.viewer.viewport.getAspectRatio()) {
|
if (this.viewer.source.aspectRatio > this.viewer.viewport.getAspectRatio()) {
|
||||||
newBounds.y = newBounds.y - ((this.viewerDimensionsInPoints.y - (1/contentAspectRatio)) /2 );
|
newBounds.y = newBounds.y - ((this.viewerSizeInPoints.y - (1/this.viewer.source.aspectRatio)) /2 );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
newBounds.x = newBounds.x - ((this.viewerDimensionsInPoints.x -1) /2 );
|
newBounds.x = newBounds.x - ((this.viewerSizeInPoints.x -1) /2 );
|
||||||
}
|
}
|
||||||
this.viewer.viewport.fitBounds(newBounds);
|
this.viewer.viewport.fitBounds(newBounds);
|
||||||
this.viewer.viewport.applyConstraints();
|
this.viewer.viewport.applyConstraints();
|
||||||
@ -282,7 +281,6 @@ function onCanvasScroll( tracker, position, scroll, shift ) {
|
|||||||
factor = Math.pow( this.zoomPerScroll, scroll );
|
factor = Math.pow( this.zoomPerScroll, scroll );
|
||||||
this.viewer.viewport.zoomBy(
|
this.viewer.viewport.zoomBy(
|
||||||
factor,
|
factor,
|
||||||
//this.viewport.pointFromPixel( position, true )
|
|
||||||
this.viewport.getCenter()
|
this.viewport.getCenter()
|
||||||
);
|
);
|
||||||
this.viewer.viewport.applyConstraints();
|
this.viewer.viewport.applyConstraints();
|
||||||
|
@ -7,10 +7,10 @@ QUnit.config.autostart = false;
|
|||||||
navigatorAspectRatio,
|
navigatorAspectRatio,
|
||||||
leftScalingFactor,
|
leftScalingFactor,
|
||||||
maxHeightFactor,
|
maxHeightFactor,
|
||||||
spaceFromLeftEdgeOfViewerToContentStart,
|
contentStartFromLeft,
|
||||||
spaceFromTopEdgeOfViewerToContentStart,
|
contentStartFromTop,
|
||||||
widthOfViewerContentOnNavigator,
|
displayRegionWidth,
|
||||||
heightOfViewerContentOnNavigator;
|
displayRegionHeight;
|
||||||
|
|
||||||
module("navigator", {
|
module("navigator", {
|
||||||
setup:function () {
|
setup:function () {
|
||||||
@ -32,10 +32,10 @@ QUnit.config.autostart = false;
|
|||||||
navigatorAspectRatio = null;
|
navigatorAspectRatio = null;
|
||||||
leftScalingFactor = null;
|
leftScalingFactor = null;
|
||||||
maxHeightFactor = null;
|
maxHeightFactor = null;
|
||||||
spaceFromLeftEdgeOfViewerToContentStart = null;
|
contentStartFromLeft = null;
|
||||||
spaceFromTopEdgeOfViewerToContentStart = null;
|
contentStartFromTop = null;
|
||||||
widthOfViewerContentOnNavigator = null;
|
displayRegionWidth = null;
|
||||||
heightOfViewerContentOnNavigator = null;
|
displayRegionHeight = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
var resetDom = function () {
|
var resetDom = function () {
|
||||||
@ -50,20 +50,20 @@ QUnit.config.autostart = false;
|
|||||||
$("#example").parent().append('<div id="exampleNavigator"></div>');
|
$("#example").parent().append('<div id="exampleNavigator"></div>');
|
||||||
};
|
};
|
||||||
|
|
||||||
var equalsWithSomeVariance = function (value1, value2, variance) {
|
var equalsWithVariance = function (value1, value2, variance) {
|
||||||
return Math.abs(value1 - value2) <= variance;
|
return Math.abs(value1 - value2) <= variance;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
var assessNumericValueWithSomeVariance = function (value1, value2, variance, message) {
|
var assessNumericValue = function (value1, value2, variance, message) {
|
||||||
ok(equalsWithSomeVariance(value1, value2, variance), message + " Expected:" + value1 + " Found: " + value2 + " Variance: " + variance);
|
ok(equalsWithVariance(value1, value2, variance), message + " Expected:" + value1 + " Found: " + value2 + " Variance: " + variance);
|
||||||
};
|
};
|
||||||
|
|
||||||
var assessNavigatorLocation = function (expectedX, expectedY) {
|
var assessNavigatorLocation = function (expectedX, expectedY) {
|
||||||
var navigator = $(".navigator");
|
var navigator = $(".navigator");
|
||||||
|
|
||||||
assessNumericValueWithSomeVariance(expectedX, navigator.offset().left, 4, ' Navigator x position');
|
assessNumericValue(expectedX, navigator.offset().left, 4, ' Navigator x position');
|
||||||
assessNumericValueWithSomeVariance(expectedY, navigator.offset().top, 4, ' Navigator y position');
|
assessNumericValue(expectedY, navigator.offset().top, 4, ' Navigator y position');
|
||||||
};
|
};
|
||||||
|
|
||||||
var navigatorRegionBoundsInPoints = function () {
|
var navigatorRegionBoundsInPoints = function () {
|
||||||
@ -84,39 +84,39 @@ QUnit.config.autostart = false;
|
|||||||
else {
|
else {
|
||||||
maxHeightFactor = viewer.source.aspectRatio;
|
maxHeightFactor = viewer.source.aspectRatio;
|
||||||
}
|
}
|
||||||
spaceFromLeftEdgeOfViewerToContentStart = ((1 / maxHeightFactor) - 1) / 2 * maxHeightFactor * navigator.width();
|
contentStartFromLeft = ((1 / maxHeightFactor) - 1) / 2 * maxHeightFactor * navigator.width();
|
||||||
spaceFromTopEdgeOfViewerToContentStart = 0;
|
contentStartFromTop = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (viewer.source.aspectRatio < navigatorAspectRatio) {
|
if (viewer.source.aspectRatio < navigatorAspectRatio) {
|
||||||
spaceFromTopEdgeOfViewerToContentStart = (navigatorAspectRatio - (1 / viewer.source.aspectRatio)) / 2 / navigatorAspectRatio * navigator.height();
|
contentStartFromTop = (navigatorAspectRatio - (1 / viewer.source.aspectRatio)) / 2 / navigatorAspectRatio * navigator.height();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
spaceFromTopEdgeOfViewerToContentStart = (navigatorAspectRatio - (1 / viewer.source.aspectRatio)) / 2 / navigatorAspectRatio * navigator.height();
|
contentStartFromTop = (navigatorAspectRatio - (1 / viewer.source.aspectRatio)) / 2 / navigatorAspectRatio * navigator.height();
|
||||||
leftScalingFactor = 1;
|
leftScalingFactor = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
widthOfViewerContentOnNavigator = navigator.width() - 2 * spaceFromLeftEdgeOfViewerToContentStart;
|
displayRegionWidth = navigator.width() - 2 * contentStartFromLeft;
|
||||||
heightOfViewerContentOnNavigator = navigator.height() - 2 * spaceFromTopEdgeOfViewerToContentStart;
|
displayRegionHeight = navigator.height() - 2 * contentStartFromTop;
|
||||||
}
|
}
|
||||||
|
|
||||||
expectedDisplayRegionWidth = navigator.width() / viewer.viewport.getZoom() * maxHeightFactor;
|
expectedDisplayRegionWidth = navigator.width() / viewer.viewport.getZoom() * maxHeightFactor;
|
||||||
expectedDisplayRegionHeight = navigator.height() / viewer.viewport.getZoom() * maxHeightFactor;
|
expectedDisplayRegionHeight = navigator.height() / viewer.viewport.getZoom() * maxHeightFactor;
|
||||||
expectedDisplayRegionXLocation = viewer.viewport.getBounds().x * maxHeightFactor * navigator.width() + spaceFromLeftEdgeOfViewerToContentStart;
|
expectedDisplayRegionXLocation = viewer.viewport.getBounds().x * maxHeightFactor * navigator.width() + contentStartFromLeft;
|
||||||
expectedDisplayRegionYLocation = viewer.viewport.getBounds().y * leftScalingFactor * navigator.width() + spaceFromTopEdgeOfViewerToContentStart;
|
expectedDisplayRegionYLocation = viewer.viewport.getBounds().y * leftScalingFactor * navigator.width() + contentStartFromTop;
|
||||||
regionBoundsInPoints = new OpenSeadragon.Rect(expectedDisplayRegionXLocation, expectedDisplayRegionYLocation, expectedDisplayRegionWidth, expectedDisplayRegionHeight);
|
regionBoundsInPoints = new OpenSeadragon.Rect(expectedDisplayRegionXLocation, expectedDisplayRegionYLocation, expectedDisplayRegionWidth, expectedDisplayRegionHeight);
|
||||||
|
|
||||||
return regionBoundsInPoints;
|
return regionBoundsInPoints;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var assessNavigatorDisplayRegionAndMainViewerState = function (status) {
|
var assessDisplayRegion = function (status) {
|
||||||
|
|
||||||
var expectedBounds = navigatorRegionBoundsInPoints();
|
var expectedBounds = navigatorRegionBoundsInPoints();
|
||||||
assessNumericValueWithSomeVariance(expectedBounds.width, displayRegion.width() + viewer.navigator.totalBorderWidths.x, 2, status + ' Width synchronization');
|
assessNumericValue(expectedBounds.width, displayRegion.width() + viewer.navigator.totalBorderWidths.x, 2, status + ' Width synchronization');
|
||||||
assessNumericValueWithSomeVariance(expectedBounds.height, displayRegion.height() + viewer.navigator.totalBorderWidths.y, 2, status + ' Height synchronization');
|
assessNumericValue(expectedBounds.height, displayRegion.height() + viewer.navigator.totalBorderWidths.y, 2, status + ' Height synchronization');
|
||||||
assessNumericValueWithSomeVariance(expectedBounds.x, displayRegion.position().left, 2, status + ' Left synchronization');
|
assessNumericValue(expectedBounds.x, displayRegion.position().left, 2, status + ' Left synchronization');
|
||||||
assessNumericValueWithSomeVariance(expectedBounds.y, displayRegion.position().top, 2, status + ' Top synchronization');
|
assessNumericValue(expectedBounds.y, displayRegion.position().top, 2, status + ' Top synchronization');
|
||||||
};
|
};
|
||||||
|
|
||||||
var waitForViewer = function () {
|
var waitForViewer = function () {
|
||||||
@ -138,11 +138,11 @@ QUnit.config.autostart = false;
|
|||||||
viewerAndNavigatorDisplayReady = viewer.drawer !== null &&
|
viewerAndNavigatorDisplayReady = viewer.drawer !== null &&
|
||||||
!viewer.drawer.needsUpdate() &&
|
!viewer.drawer.needsUpdate() &&
|
||||||
currentDisplayWidth > 0 &&
|
currentDisplayWidth > 0 &&
|
||||||
equalsWithSomeVariance(lastDisplayRegionLeft, currentDisplayRegionLeft, .0001) &&
|
equalsWithVariance(lastDisplayRegionLeft, currentDisplayRegionLeft, .0001) &&
|
||||||
equalsWithSomeVariance(lastDisplayWidth, currentDisplayWidth, .0001) &&
|
equalsWithVariance(lastDisplayWidth, currentDisplayWidth, .0001) &&
|
||||||
equalsWithSomeVariance(viewer.viewport.getBounds(true).x, viewer.viewport.getBounds().x, .0001) &&
|
equalsWithVariance(viewer.viewport.getBounds(true).x, viewer.viewport.getBounds().x, .0001) &&
|
||||||
equalsWithSomeVariance(viewer.viewport.getBounds(true).y, viewer.viewport.getBounds().y, .0001) &&
|
equalsWithVariance(viewer.viewport.getBounds(true).y, viewer.viewport.getBounds().y, .0001) &&
|
||||||
equalsWithSomeVariance(viewer.viewport.getBounds(true).width, viewer.viewport.getBounds().width, .0001);
|
equalsWithVariance(viewer.viewport.getBounds(true).width, viewer.viewport.getBounds().width, .0001);
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
//Ignore. Subsequent code will try again shortly
|
//Ignore. Subsequent code will try again shortly
|
||||||
@ -213,10 +213,10 @@ QUnit.config.autostart = false;
|
|||||||
expecteYCoordinate = 1 / viewer.source.aspectRatio - viewer.viewport.getBounds().height;
|
expecteYCoordinate = 1 / viewer.source.aspectRatio - viewer.viewport.getBounds().height;
|
||||||
}
|
}
|
||||||
if (viewer.viewport.getBounds().width < 1) {
|
if (viewer.viewport.getBounds().width < 1) {
|
||||||
assessNumericValueWithSomeVariance(expectedXCoordinate, viewer.viewport.getBounds().x, .04, ' Viewer at ' + theContentCorner + ', x coord');
|
assessNumericValue(expectedXCoordinate, viewer.viewport.getBounds().x, .04, ' Viewer at ' + theContentCorner + ', x coord');
|
||||||
}
|
}
|
||||||
if (viewer.viewport.getBounds().height < 1 / viewer.source.aspectRatio) {
|
if (viewer.viewport.getBounds().height < 1 / viewer.source.aspectRatio) {
|
||||||
assessNumericValueWithSomeVariance(expecteYCoordinate, viewer.viewport.getBounds().y, .04, ' Viewer at ' + theContentCorner + ', y coord');
|
assessNumericValue(expecteYCoordinate, viewer.viewport.getBounds().y, .04, ' Viewer at ' + theContentCorner + ', y coord');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -226,8 +226,8 @@ QUnit.config.autostart = false;
|
|||||||
if (viewer.source.aspectRatio < 1) {
|
if (viewer.source.aspectRatio < 1) {
|
||||||
yPositionVariance = yPositionVariance / viewer.source.aspectRatio;
|
yPositionVariance = yPositionVariance / viewer.source.aspectRatio;
|
||||||
}
|
}
|
||||||
assessNumericValueWithSomeVariance(1 / viewer.source.aspectRatio / 2, viewer.viewport.getCenter().y, yPositionVariance, ' Viewer at center, y coord');
|
assessNumericValue(1 / viewer.source.aspectRatio / 2, viewer.viewport.getCenter().y, yPositionVariance, ' Viewer at center, y coord');
|
||||||
assessNumericValueWithSomeVariance(.5, viewer.viewport.getCenter().x, .4, ' Viewer at center, x coord');
|
assessNumericValue(.5, viewer.viewport.getCenter().x, .4, ' Viewer at center, x coord');
|
||||||
};
|
};
|
||||||
|
|
||||||
var clickOnNavigator = function (theContentCorner) {
|
var clickOnNavigator = function (theContentCorner) {
|
||||||
@ -235,20 +235,20 @@ QUnit.config.autostart = false;
|
|||||||
var xPos,
|
var xPos,
|
||||||
yPos;
|
yPos;
|
||||||
if (theContentCorner === "TOPLEFT") {
|
if (theContentCorner === "TOPLEFT") {
|
||||||
xPos = spaceFromLeftEdgeOfViewerToContentStart;
|
xPos = contentStartFromLeft;
|
||||||
yPos = spaceFromTopEdgeOfViewerToContentStart;
|
yPos = contentStartFromTop;
|
||||||
}
|
}
|
||||||
else if (theContentCorner === "TOPRIGHT") {
|
else if (theContentCorner === "TOPRIGHT") {
|
||||||
xPos = spaceFromLeftEdgeOfViewerToContentStart + widthOfViewerContentOnNavigator;
|
xPos = contentStartFromLeft + displayRegionWidth;
|
||||||
yPos = spaceFromTopEdgeOfViewerToContentStart;
|
yPos = contentStartFromTop;
|
||||||
}
|
}
|
||||||
else if (theContentCorner === "BOTTOMRIGHT") {
|
else if (theContentCorner === "BOTTOMRIGHT") {
|
||||||
xPos = spaceFromLeftEdgeOfViewerToContentStart + widthOfViewerContentOnNavigator;
|
xPos = contentStartFromLeft + displayRegionWidth;
|
||||||
yPos = spaceFromTopEdgeOfViewerToContentStart + heightOfViewerContentOnNavigator;
|
yPos = contentStartFromTop + displayRegionHeight;
|
||||||
}
|
}
|
||||||
else if (theContentCorner === "BOTTOMLEFT") {
|
else if (theContentCorner === "BOTTOMLEFT") {
|
||||||
xPos = spaceFromLeftEdgeOfViewerToContentStart;
|
xPos = contentStartFromLeft;
|
||||||
yPos = spaceFromTopEdgeOfViewerToContentStart + heightOfViewerContentOnNavigator;
|
yPos = contentStartFromTop + displayRegionHeight;
|
||||||
}
|
}
|
||||||
simulateNavigatorClick(viewer.navigator, xPos, yPos);
|
simulateNavigatorClick(viewer.navigator, xPos, yPos);
|
||||||
}
|
}
|
||||||
@ -262,7 +262,7 @@ QUnit.config.autostart = false;
|
|||||||
if (viewer.source.aspectRatio < 1) {
|
if (viewer.source.aspectRatio < 1) {
|
||||||
delta.y = delta.y * viewer.source.aspectRatio;
|
delta.y = delta.y * viewer.source.aspectRatio;
|
||||||
}
|
}
|
||||||
simulateNavigatorDrag(viewer.navigator, delta.x * widthOfViewerContentOnNavigator, delta.y * heightOfViewerContentOnNavigator);
|
simulateNavigatorDrag(viewer.navigator, delta.x * displayRegionWidth, delta.y * displayRegionHeight);
|
||||||
};
|
};
|
||||||
|
|
||||||
var assessNavigatorViewerPlacement = function (seadragonProperties, testProperties) {
|
var assessNavigatorViewerPlacement = function (seadragonProperties, testProperties) {
|
||||||
@ -291,7 +291,8 @@ QUnit.config.autostart = false;
|
|||||||
{interactionOperation:dragNavigatorBackToCenter,
|
{interactionOperation:dragNavigatorBackToCenter,
|
||||||
assessmentOperation:assessViewerInCenter,
|
assessmentOperation:assessViewerInCenter,
|
||||||
assessmentMessage:"After drag on navigator from top left" }
|
assessmentMessage:"After drag on navigator from top left" }
|
||||||
];
|
],
|
||||||
|
autoHideWaitTime = 7500;
|
||||||
|
|
||||||
seadragonProperties.visibilityRatio = 1;
|
seadragonProperties.visibilityRatio = 1;
|
||||||
viewer = OpenSeadragon(seadragonProperties);
|
viewer = OpenSeadragon(seadragonProperties);
|
||||||
@ -299,7 +300,7 @@ QUnit.config.autostart = false;
|
|||||||
var assessNavigatorOperationAndTakeNextStep = function (step) {
|
var assessNavigatorOperationAndTakeNextStep = function (step) {
|
||||||
return function () {
|
return function () {
|
||||||
var nextStep = step + 1;
|
var nextStep = step + 1;
|
||||||
assessNavigatorDisplayRegionAndMainViewerState(navigatorOperationScenarios[step].assessmentMessage);
|
assessDisplayRegion(navigatorOperationScenarios[step].assessmentMessage);
|
||||||
navigatorOperationScenarios[step].assessmentOperation();
|
navigatorOperationScenarios[step].assessmentOperation();
|
||||||
if (step === navigatorOperationScenarios.length - 1) {
|
if (step === navigatorOperationScenarios.length - 1) {
|
||||||
start();
|
start();
|
||||||
@ -312,20 +313,20 @@ QUnit.config.autostart = false;
|
|||||||
};
|
};
|
||||||
|
|
||||||
var assessAfterDragOnViewer = function () {
|
var assessAfterDragOnViewer = function () {
|
||||||
assessNavigatorDisplayRegionAndMainViewerState("After pan");
|
assessDisplayRegion("After pan");
|
||||||
navigatorOperationScenarios[0].interactionOperation();
|
navigatorOperationScenarios[0].interactionOperation();
|
||||||
waitForViewer(assessNavigatorOperationAndTakeNextStep(0));
|
waitForViewer(assessNavigatorOperationAndTakeNextStep(0));
|
||||||
};
|
};
|
||||||
|
|
||||||
var assessAfterZoomOnViewer = function () {
|
var assessAfterZoomOnViewer = function () {
|
||||||
var target = new OpenSeadragon.Point(0.4, 0.4);
|
var target = new OpenSeadragon.Point(0.4, 0.4);
|
||||||
assessNavigatorDisplayRegionAndMainViewerState("After image zoom");
|
assessDisplayRegion("After image zoom");
|
||||||
viewer.viewport.panTo(target);
|
viewer.viewport.panTo(target);
|
||||||
waitForViewer(assessAfterDragOnViewer);
|
waitForViewer(assessAfterDragOnViewer);
|
||||||
};
|
};
|
||||||
|
|
||||||
var captureInitialStateAfterOpenAndThenAct = function () {
|
var captureInitialStateThenAct = function () {
|
||||||
assessNavigatorDisplayRegionAndMainViewerState("After image load");
|
assessDisplayRegion("After image load");
|
||||||
|
|
||||||
testProperties.determineExpectationsAndAssessNavigatorLocation(seadragonProperties, testProperties);
|
testProperties.determineExpectationsAndAssessNavigatorLocation(seadragonProperties, testProperties);
|
||||||
|
|
||||||
@ -334,32 +335,32 @@ QUnit.config.autostart = false;
|
|||||||
};
|
};
|
||||||
|
|
||||||
var assessAutohideTriggered = function () {
|
var assessAutohideTriggered = function () {
|
||||||
ok($(testProperties.navigatorLocator).parent().css("opacity") == 0);
|
ok($(testProperties.navigatorLocator).parent().css("opacity") == 0, "Expecting navigator to be autohide when in the default location");
|
||||||
waitForViewer(captureInitialStateAfterOpenAndThenAct);
|
waitForViewer(captureInitialStateThenAct);
|
||||||
};
|
};
|
||||||
|
|
||||||
var assessAutohideDisabled = function () {
|
var assessAutohideDisabled = function () {
|
||||||
ok($(testProperties.navigatorLocator).parent().css("opacity") > 0);
|
ok($(testProperties.navigatorLocator).parent().css("opacity") > 0, "Expecting navigator to be always visible when in a custom location");
|
||||||
waitForViewer(captureInitialStateAfterOpenAndThenAct);
|
waitForViewer(captureInitialStateThenAct);
|
||||||
};
|
};
|
||||||
|
|
||||||
var openHandler = function () {
|
var openHandler = function () {
|
||||||
viewer.removeHandler('open', openHandler);
|
viewer.removeHandler('open', openHandler);
|
||||||
if (!testProperties.testAutohide) {
|
if (!testProperties.testAutohide) {
|
||||||
waitForViewer(captureInitialStateAfterOpenAndThenAct);
|
waitForViewer(captureInitialStateThenAct);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ok($(testProperties.navigatorLocator).parent().css("opacity") > 0);
|
ok($(testProperties.navigatorLocator).parent().css("opacity") > 0, "Expecting navigator to be visible initially");
|
||||||
var event = {
|
var event = {
|
||||||
clientX:1,
|
clientX:1,
|
||||||
clientY:1
|
clientY:1
|
||||||
};
|
};
|
||||||
var body = $("body").simulate('mouseover', event);
|
var body = $("body").simulate('mouseover', event);
|
||||||
if (testProperties.expectedAutoHide) {
|
if (testProperties.expectedAutoHide) {
|
||||||
setTimeout(assessAutohideTriggered,5000);
|
setTimeout(assessAutohideTriggered,autoHideWaitTime);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setTimeout(assessAutohideDisabled,5000);
|
setTimeout(assessAutohideDisabled,autoHideWaitTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user