Implemented fix for a test failure that shows up on Firefox in some situtions

This commit is contained in:
houseofyin 2013-06-12 15:06:17 -04:00
parent af1f1b64af
commit 1833f85232

View File

@ -10,7 +10,8 @@ QUnit.config.autostart = false;
contentStartFromLeft, contentStartFromLeft,
contentStartFromTop, contentStartFromTop,
displayRegionWidth, displayRegionWidth,
displayRegionHeight; displayRegionHeight,
topNavigatorClickAdjustment;
module("navigator", { module("navigator", {
setup:function () { setup:function () {
@ -42,6 +43,7 @@ QUnit.config.autostart = false;
contentStartFromTop = null; contentStartFromTop = null;
displayRegionWidth = null; displayRegionWidth = null;
displayRegionHeight = null; displayRegionHeight = null;
topNavigatorClickAdjustment = 0;
}; };
var assessNavigatorLocation = function (expectedX, expectedY) { var assessNavigatorLocation = function (expectedX, expectedY) {
@ -222,11 +224,11 @@ QUnit.config.autostart = false;
yPos; yPos;
if (theContentCorner === "TOPLEFT") { if (theContentCorner === "TOPLEFT") {
xPos = contentStartFromLeft; xPos = contentStartFromLeft;
yPos = contentStartFromTop; yPos = contentStartFromTop + topNavigatorClickAdjustment;
} }
else if (theContentCorner === "TOPRIGHT") { else if (theContentCorner === "TOPRIGHT") {
xPos = contentStartFromLeft + displayRegionWidth; xPos = contentStartFromLeft + displayRegionWidth;
yPos = contentStartFromTop; yPos = contentStartFromTop+ topNavigatorClickAdjustment;
} }
else if (theContentCorner === "BOTTOMRIGHT") { else if (theContentCorner === "BOTTOMRIGHT") {
xPos = contentStartFromLeft + displayRegionWidth; xPos = contentStartFromLeft + displayRegionWidth;
@ -283,6 +285,11 @@ QUnit.config.autostart = false;
seadragonProperties.visibilityRatio = 1; seadragonProperties.visibilityRatio = 1;
viewer = OpenSeadragon(seadragonProperties); viewer = OpenSeadragon(seadragonProperties);
if ($.isNumeric(testProperties.topNavigatorClickAdjustment))
{
topNavigatorClickAdjustment = testProperties.topNavigatorClickAdjustment;
}
var assessNavigatorOperationAndTakeNextStep = function (step) { var assessNavigatorOperationAndTakeNextStep = function (step) {
return function () { return function () {
var nextStep = step + 1; var nextStep = step + 1;
@ -298,12 +305,18 @@ QUnit.config.autostart = false;
}; };
}; };
var assessAfterDragOnViewer = function () { var assessAfterSnapback = function () {
assessDisplayRegion("After pan"); assessDisplayRegion("After snapback");
navigatorOperationScenarios[0].interactionOperation(); navigatorOperationScenarios[0].interactionOperation();
waitForViewer(assessNavigatorOperationAndTakeNextStep(0)); waitForViewer(assessNavigatorOperationAndTakeNextStep(0));
}; };
var assessAfterDragOnViewer = function () {
assessDisplayRegion("After pan");
viewer.viewport.applyConstraints();
waitForViewer(assessAfterSnapback);
};
var assessAfterZoomOnViewer = function () { var assessAfterZoomOnViewer = function () {
var target = new OpenSeadragon.Point(0.4, 0.4); var target = new OpenSeadragon.Point(0.4, 0.4);
assessDisplayRegion("After image zoom"); assessDisplayRegion("After image zoom");
@ -413,6 +426,9 @@ QUnit.config.autostart = false;
navigatorLocator:'#exampleNavigator', navigatorLocator:'#exampleNavigator',
testAutoFade: true, testAutoFade: true,
expectedAutoFade: false, expectedAutoFade: false,
//On Firefox at some screen size/resolution/magnification combinations, there is an issue with the
//simulated click. This property is a work around for that problem
topNavigatorClickAdjustment: 15,
determineExpectationsAndAssessNavigatorLocation:function (seadragonProperties, testProperties) { determineExpectationsAndAssessNavigatorLocation:function (seadragonProperties, testProperties) {
var jqueryDialog = $(testProperties.navigatorLocator); var jqueryDialog = $(testProperties.navigatorLocator);
assessNavigatorLocation(jqueryDialog.offset().left, assessNavigatorLocation(jqueryDialog.offset().left,