mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-29 16:46:08 +03:00
Refactored to replace parallel arrays with an object
This commit is contained in:
parent
6b97ab4424
commit
50a9cecd35
@ -23,24 +23,22 @@ QUnit.config.autostart = false;
|
|||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
|
|
||||||
var resetTestVariables = function()
|
var resetTestVariables = function () {
|
||||||
{
|
if (viewer != null) {
|
||||||
if (viewer != null) {
|
viewer.close();
|
||||||
viewer.close();
|
}
|
||||||
}
|
displayRegion = null;
|
||||||
displayRegion = null;
|
navigator = null;
|
||||||
navigator = null;
|
navigatorAspectRatio = null;
|
||||||
navigatorAspectRatio = null;
|
leftScalingFactor = null;
|
||||||
leftScalingFactor = null;
|
maxHeightFactor = null;
|
||||||
maxHeightFactor = null;
|
spaceFromLeftEdgeOfViewerToContentStart = null;
|
||||||
spaceFromLeftEdgeOfViewerToContentStart = null;
|
spaceFromTopEdgeOfViewerToContentStart = null;
|
||||||
spaceFromTopEdgeOfViewerToContentStart = null;
|
widthOfViewerContentOnNavigator = null;
|
||||||
widthOfViewerContentOnNavigator = null;
|
heightOfViewerContentOnNavigator = null;
|
||||||
heightOfViewerContentOnNavigator = null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var resetDom = function()
|
var resetDom = function () {
|
||||||
{
|
|
||||||
if ($('#exampleNavigator').is(':ui-dialog')) {
|
if ($('#exampleNavigator').is(':ui-dialog')) {
|
||||||
$('#exampleNavigator').dialog('destroy');
|
$('#exampleNavigator').dialog('destroy');
|
||||||
}
|
}
|
||||||
@ -68,37 +66,29 @@ QUnit.config.autostart = false;
|
|||||||
assessNumericValueWithSomeVariance(expectedY, navigator.offset().top, 4, ' Navigator y position');
|
assessNumericValueWithSomeVariance(expectedY, navigator.offset().top, 4, ' Navigator y position');
|
||||||
};
|
};
|
||||||
|
|
||||||
var navigatorRegionBoundsInPoints = function ()
|
var navigatorRegionBoundsInPoints = function () {
|
||||||
{
|
|
||||||
var regionBoundsInPoints;
|
var regionBoundsInPoints;
|
||||||
if (navigator === null)
|
if (navigator === null) {
|
||||||
{
|
|
||||||
maxHeightFactor = 1;
|
maxHeightFactor = 1;
|
||||||
navigator = $(".navigator");
|
navigator = $(".navigator");
|
||||||
navigatorAspectRatio = navigator.height() /navigator.width();
|
navigatorAspectRatio = navigator.height() / navigator.width();
|
||||||
leftScalingFactor = navigatorAspectRatio * viewer.source.aspectRatio;
|
leftScalingFactor = navigatorAspectRatio * viewer.source.aspectRatio;
|
||||||
if (viewer.source.aspectRatio < 1)
|
if (viewer.source.aspectRatio < 1) {
|
||||||
{
|
if (viewer.source.aspectRatio < navigatorAspectRatio) {
|
||||||
if (viewer.source.aspectRatio < navigatorAspectRatio)
|
maxHeightFactor = viewer.source.aspectRatio * navigatorAspectRatio;
|
||||||
{
|
|
||||||
maxHeightFactor = viewer.source.aspectRatio * navigatorAspectRatio;
|
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
maxHeightFactor = viewer.source.aspectRatio;
|
||||||
maxHeightFactor = viewer.source.aspectRatio;
|
|
||||||
}
|
}
|
||||||
spaceFromLeftEdgeOfViewerToContentStart = ((1/maxHeightFactor)-1) / 2 * maxHeightFactor * navigator.width();
|
spaceFromLeftEdgeOfViewerToContentStart = ((1 / maxHeightFactor) - 1) / 2 * maxHeightFactor * navigator.width();
|
||||||
spaceFromTopEdgeOfViewerToContentStart = 0;
|
spaceFromTopEdgeOfViewerToContentStart = 0;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
if (viewer.source.aspectRatio < navigatorAspectRatio) {
|
||||||
if (viewer.source.aspectRatio < navigatorAspectRatio)
|
spaceFromTopEdgeOfViewerToContentStart = (navigatorAspectRatio - (1 / viewer.source.aspectRatio)) / 2 / navigatorAspectRatio * navigator.height();
|
||||||
{
|
|
||||||
spaceFromTopEdgeOfViewerToContentStart = (navigatorAspectRatio - (1/viewer.source.aspectRatio)) / 2 /navigatorAspectRatio * navigator.height();
|
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
spaceFromTopEdgeOfViewerToContentStart = (navigatorAspectRatio - (1 / viewer.source.aspectRatio)) / 2 / navigatorAspectRatio * navigator.height();
|
||||||
spaceFromTopEdgeOfViewerToContentStart = (navigatorAspectRatio - (1/viewer.source.aspectRatio)) / 2 /navigatorAspectRatio * navigator.height();
|
|
||||||
leftScalingFactor = 1;
|
leftScalingFactor = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -108,9 +98,9 @@ QUnit.config.autostart = false;
|
|||||||
|
|
||||||
var expectedDisplayRegionWidth = navigator.width() / viewer.viewport.getZoom() * maxHeightFactor;
|
var expectedDisplayRegionWidth = navigator.width() / viewer.viewport.getZoom() * maxHeightFactor;
|
||||||
var expectedDisplayRegionHeight = navigator.height() / viewer.viewport.getZoom() * maxHeightFactor;
|
var expectedDisplayRegionHeight = navigator.height() / viewer.viewport.getZoom() * maxHeightFactor;
|
||||||
var expectedDisplayRegionXLocation = viewer.viewport.getBounds().x * maxHeightFactor * navigator.width() + spaceFromLeftEdgeOfViewerToContentStart;
|
var expectedDisplayRegionXLocation = viewer.viewport.getBounds().x * maxHeightFactor * navigator.width() + spaceFromLeftEdgeOfViewerToContentStart;
|
||||||
var expectedDisplayRegionYLocation = viewer.viewport.getBounds().y * leftScalingFactor * navigator.width() + spaceFromTopEdgeOfViewerToContentStart ;
|
var expectedDisplayRegionYLocation = viewer.viewport.getBounds().y * leftScalingFactor * navigator.width() + spaceFromTopEdgeOfViewerToContentStart;
|
||||||
regionBoundsInPoints = new OpenSeadragon.Rect(expectedDisplayRegionXLocation,expectedDisplayRegionYLocation,expectedDisplayRegionWidth,expectedDisplayRegionHeight);
|
regionBoundsInPoints = new OpenSeadragon.Rect(expectedDisplayRegionXLocation, expectedDisplayRegionYLocation, expectedDisplayRegionWidth, expectedDisplayRegionHeight);
|
||||||
|
|
||||||
|
|
||||||
return regionBoundsInPoints;
|
return regionBoundsInPoints;
|
||||||
@ -129,64 +119,62 @@ QUnit.config.autostart = false;
|
|||||||
var waitForViewer = function () {
|
var waitForViewer = function () {
|
||||||
return function (handler, count, lastDisplayRegionLeft, lastDisplayWidth) {
|
return function (handler, count, lastDisplayRegionLeft, lastDisplayWidth) {
|
||||||
// return function () {
|
// return function () {
|
||||||
var currentDisplayRegionLeft;
|
var currentDisplayRegionLeft;
|
||||||
var currentDisplayWidth;
|
var currentDisplayWidth;
|
||||||
if (displayRegion === null)
|
if (displayRegion === null) {
|
||||||
{
|
displayRegion = $(".displayregion");
|
||||||
displayRegion = $(".displayregion");
|
}
|
||||||
|
var viewerAndNavigatorDisplayReady = false;
|
||||||
|
if (typeof count !== "number") {
|
||||||
|
count = 0;
|
||||||
|
lastDisplayRegionLeft = null;
|
||||||
|
lastDisplayWidth = null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
currentDisplayRegionLeft = displayRegion.position().left;
|
||||||
|
currentDisplayWidth = displayRegion.width();
|
||||||
|
viewerAndNavigatorDisplayReady = viewer.drawer !== null &&
|
||||||
|
!viewer.drawer.needsUpdate() &&
|
||||||
|
currentDisplayWidth > 0 &&
|
||||||
|
equalsWithSomeVariance(lastDisplayRegionLeft, currentDisplayRegionLeft, .0001) &&
|
||||||
|
equalsWithSomeVariance(lastDisplayWidth, currentDisplayWidth, .0001) &&
|
||||||
|
equalsWithSomeVariance(viewer.viewport.getBounds(true).x, viewer.viewport.getBounds().x, .0001) &&
|
||||||
|
equalsWithSomeVariance(viewer.viewport.getBounds(true).y, viewer.viewport.getBounds().y, .0001) &&
|
||||||
|
equalsWithSomeVariance(viewer.viewport.getBounds(true).width, viewer.viewport.getBounds().width, .0001);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
//Ignore. Subsequent code will try again shortly
|
||||||
|
}
|
||||||
|
if (( !viewerAndNavigatorDisplayReady) && count < 50) {
|
||||||
|
count++;
|
||||||
|
setTimeout(function () {
|
||||||
|
waitForViewer(handler, count, currentDisplayRegionLeft, currentDisplayWidth);
|
||||||
|
}, 100)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (count === 40) {
|
||||||
|
console.log("waitForViewer:" +
|
||||||
|
viewer.drawer + ":" + viewer.drawer.needsUpdate() + ":" +
|
||||||
|
viewerAndNavigatorDisplayReady + ":" +
|
||||||
|
lastDisplayRegionLeft + ":" + currentDisplayRegionLeft + ":" +
|
||||||
|
lastDisplayWidth + ":" + currentDisplayWidth + ":" +
|
||||||
|
viewer.viewport.getBounds(true).x + ":" + viewer.viewport.getBounds().x + ":" +
|
||||||
|
viewer.viewport.getBounds(true).y + ":" + viewer.viewport.getBounds().y + ":" +
|
||||||
|
viewer.viewport.getBounds(true).width + ":" + viewer.viewport.getBounds().width + ":" +
|
||||||
|
count);
|
||||||
}
|
}
|
||||||
var viewerAndNavigatorDisplayReady = false;
|
handler();
|
||||||
if (typeof count !== "number") {
|
}
|
||||||
count = 0;
|
};
|
||||||
lastDisplayRegionLeft = null;
|
|
||||||
lastDisplayWidth = null;
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
currentDisplayRegionLeft = displayRegion.position().left;
|
|
||||||
currentDisplayWidth = displayRegion.width();
|
|
||||||
viewerAndNavigatorDisplayReady = viewer.drawer !== null &&
|
|
||||||
!viewer.drawer.needsUpdate() &&
|
|
||||||
currentDisplayWidth > 0 &&
|
|
||||||
equalsWithSomeVariance(lastDisplayRegionLeft, currentDisplayRegionLeft,.0001) &&
|
|
||||||
equalsWithSomeVariance(lastDisplayWidth,currentDisplayWidth,.0001) &&
|
|
||||||
equalsWithSomeVariance(viewer.viewport.getBounds(true).x,viewer.viewport.getBounds().x,.0001) &&
|
|
||||||
equalsWithSomeVariance(viewer.viewport.getBounds(true).y,viewer.viewport.getBounds().y,.0001) &&
|
|
||||||
equalsWithSomeVariance(viewer.viewport.getBounds(true).width,viewer.viewport.getBounds().width,.0001);
|
|
||||||
}
|
|
||||||
catch(err)
|
|
||||||
{
|
|
||||||
//Ignore. Subsequent code will try again shortly
|
|
||||||
}
|
|
||||||
if (( !viewerAndNavigatorDisplayReady) && count < 50) {
|
|
||||||
count++;
|
|
||||||
setTimeout(function () {waitForViewer(handler, count, currentDisplayRegionLeft, currentDisplayWidth);}, 100)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (count === 40)
|
|
||||||
{
|
|
||||||
console.log( "waitForViewer:" +
|
|
||||||
viewer.drawer + ":" + viewer.drawer.needsUpdate() + ":" +
|
|
||||||
viewerAndNavigatorDisplayReady + ":" +
|
|
||||||
lastDisplayRegionLeft + ":" + currentDisplayRegionLeft + ":" +
|
|
||||||
lastDisplayWidth + ":" + currentDisplayWidth + ":" +
|
|
||||||
viewer.viewport.getBounds(true).x + ":" + viewer.viewport.getBounds().x + ":" +
|
|
||||||
viewer.viewport.getBounds(true).y + ":" + viewer.viewport.getBounds().y + ":" +
|
|
||||||
viewer.viewport.getBounds(true).width + ":" + viewer.viewport.getBounds().width + ":" +
|
|
||||||
count );
|
|
||||||
}
|
|
||||||
handler();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
// }();
|
// }();
|
||||||
}();
|
}();
|
||||||
|
|
||||||
var simulateNavigatorClick = function(viewer, locationX, locationY) {
|
var simulateNavigatorClick = function (viewer, locationX, locationY) {
|
||||||
var $canvas = $(viewer.element).find('.openseadragon-canvas');
|
var $canvas = $(viewer.element).find('.openseadragon-canvas');
|
||||||
var offset = $canvas.offset();
|
var offset = $canvas.offset();
|
||||||
var event = {
|
var event = {
|
||||||
clientX: offset.left + locationX,
|
clientX:offset.left + locationX,
|
||||||
clientY: offset.top + locationY
|
clientY:offset.top + locationY
|
||||||
};
|
};
|
||||||
|
|
||||||
$canvas
|
$canvas
|
||||||
@ -195,104 +183,86 @@ QUnit.config.autostart = false;
|
|||||||
.simulate('mouseup', event);
|
.simulate('mouseup', event);
|
||||||
};
|
};
|
||||||
|
|
||||||
var simulateNavigatorDrag = function(viewer, distanceX, distanceY) {
|
var simulateNavigatorDrag = function (viewer, distanceX, distanceY) {
|
||||||
var $canvas = $(viewer.element).find('.displayregion');
|
var $canvas = $(viewer.element).find('.displayregion');
|
||||||
var event = {
|
var event = {
|
||||||
dx: Math.floor(distanceX),
|
dx:Math.floor(distanceX),
|
||||||
dy: Math.floor(distanceY)
|
dy:Math.floor(distanceY)
|
||||||
};
|
};
|
||||||
|
|
||||||
$canvas
|
$canvas
|
||||||
.simulate('drag', event);
|
.simulate('drag', event);
|
||||||
};
|
};
|
||||||
|
|
||||||
var assessViewerInCorner = function(theContentCorner)
|
var assessViewerInCorner = function (theContentCorner) {
|
||||||
{
|
return function () {
|
||||||
return function()
|
var expectedXCoordinate, expecteYCoordinate;
|
||||||
{
|
if (theContentCorner === "TOPLEFT") {
|
||||||
var expectedXCoordinate, expecteYCoordinate;
|
expectedXCoordinate = 0;
|
||||||
if (theContentCorner === "TOPLEFT")
|
expecteYCoordinate = 0;
|
||||||
{
|
}
|
||||||
expectedXCoordinate = 0;
|
else if (theContentCorner === "TOPRIGHT") {
|
||||||
expecteYCoordinate = 0;
|
expectedXCoordinate = 1 - viewer.viewport.getBounds().width;
|
||||||
}
|
expecteYCoordinate = 0;
|
||||||
else if (theContentCorner === "TOPRIGHT")
|
}
|
||||||
{
|
else if (theContentCorner === "BOTTOMRIGHT") {
|
||||||
expectedXCoordinate = 1-viewer.viewport.getBounds().width;
|
expectedXCoordinate = 1 - viewer.viewport.getBounds().width;
|
||||||
expecteYCoordinate = 0;
|
expecteYCoordinate = 1 / viewer.source.aspectRatio - viewer.viewport.getBounds().height;
|
||||||
}
|
}
|
||||||
else if (theContentCorner === "BOTTOMRIGHT")
|
else if (theContentCorner === "BOTTOMLEFT") {
|
||||||
{
|
expectedXCoordinate = 0;
|
||||||
expectedXCoordinate = 1-viewer.viewport.getBounds().width;
|
expecteYCoordinate = 1 / viewer.source.aspectRatio - viewer.viewport.getBounds().height;
|
||||||
expecteYCoordinate = 1/viewer.source.aspectRatio - viewer.viewport.getBounds().height;
|
}
|
||||||
}
|
if (viewer.viewport.getBounds().width < 1) {
|
||||||
else if (theContentCorner === "BOTTOMLEFT")
|
assessNumericValueWithSomeVariance(expectedXCoordinate, viewer.viewport.getBounds().x, .04, ' Viewer at ' + theContentCorner + ', x coord');
|
||||||
{
|
}
|
||||||
expectedXCoordinate = 0;
|
if (viewer.viewport.getBounds().height < 1 / viewer.source.aspectRatio) {
|
||||||
expecteYCoordinate = 1/viewer.source.aspectRatio - viewer.viewport.getBounds().height;
|
assessNumericValueWithSomeVariance(expecteYCoordinate, viewer.viewport.getBounds().y, .04, ' Viewer at ' + theContentCorner + ', y coord');
|
||||||
}
|
}
|
||||||
if (viewer.viewport.getBounds().width < 1)
|
|
||||||
{
|
|
||||||
assessNumericValueWithSomeVariance(expectedXCoordinate, viewer.viewport.getBounds().x,.04, ' Viewer at ' + theContentCorner + ', x coord');
|
|
||||||
}
|
}
|
||||||
if (viewer.viewport.getBounds().height < 1/viewer.source.aspectRatio)
|
|
||||||
{
|
|
||||||
assessNumericValueWithSomeVariance(expecteYCoordinate, viewer.viewport.getBounds().y,.04, ' Viewer at ' + theContentCorner + ', y coord');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var assessViewerInCenter = function()
|
var assessViewerInCenter = function () {
|
||||||
{
|
|
||||||
var yPositionVariance = .04;
|
var yPositionVariance = .04;
|
||||||
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');
|
assessNumericValueWithSomeVariance(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');
|
assessNumericValueWithSomeVariance(.5, viewer.viewport.getCenter().x, .4, ' Viewer at center, x coord');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
var clickOnNavigator = function(theContentCorner)
|
var clickOnNavigator = function (theContentCorner) {
|
||||||
{
|
return function () {
|
||||||
return function()
|
var xPos, yPos;
|
||||||
{
|
if (theContentCorner === "TOPLEFT") {
|
||||||
var xPos, yPos;
|
xPos = spaceFromLeftEdgeOfViewerToContentStart;
|
||||||
if (theContentCorner === "TOPLEFT")
|
yPos = spaceFromTopEdgeOfViewerToContentStart;
|
||||||
{
|
}
|
||||||
xPos = spaceFromLeftEdgeOfViewerToContentStart;
|
else if (theContentCorner === "TOPRIGHT") {
|
||||||
yPos = spaceFromTopEdgeOfViewerToContentStart;
|
xPos = spaceFromLeftEdgeOfViewerToContentStart + widthOfViewerContentOnNavigator;
|
||||||
}
|
yPos = spaceFromTopEdgeOfViewerToContentStart;
|
||||||
else if (theContentCorner === "TOPRIGHT")
|
}
|
||||||
{
|
else if (theContentCorner === "BOTTOMRIGHT") {
|
||||||
xPos = spaceFromLeftEdgeOfViewerToContentStart + widthOfViewerContentOnNavigator;
|
xPos = spaceFromLeftEdgeOfViewerToContentStart + widthOfViewerContentOnNavigator;
|
||||||
yPos = spaceFromTopEdgeOfViewerToContentStart;
|
yPos = spaceFromTopEdgeOfViewerToContentStart + heightOfViewerContentOnNavigator;
|
||||||
}
|
}
|
||||||
else if (theContentCorner === "BOTTOMRIGHT")
|
else if (theContentCorner === "BOTTOMLEFT") {
|
||||||
{
|
xPos = spaceFromLeftEdgeOfViewerToContentStart;
|
||||||
xPos = spaceFromLeftEdgeOfViewerToContentStart + widthOfViewerContentOnNavigator;
|
yPos = spaceFromTopEdgeOfViewerToContentStart + heightOfViewerContentOnNavigator;
|
||||||
yPos = spaceFromTopEdgeOfViewerToContentStart + heightOfViewerContentOnNavigator;
|
}
|
||||||
}
|
|
||||||
else if (theContentCorner === "BOTTOMLEFT")
|
|
||||||
{
|
|
||||||
xPos = spaceFromLeftEdgeOfViewerToContentStart;
|
|
||||||
yPos = spaceFromTopEdgeOfViewerToContentStart + heightOfViewerContentOnNavigator;
|
|
||||||
}
|
|
||||||
simulateNavigatorClick(viewer.navigator, xPos, yPos);
|
simulateNavigatorClick(viewer.navigator, xPos, yPos);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var dragNavigatorBackToCenter = function()
|
var dragNavigatorBackToCenter = function () {
|
||||||
{
|
|
||||||
var start = viewer.viewport.getBounds().getTopLeft();
|
var start = viewer.viewport.getBounds().getTopLeft();
|
||||||
var target = new OpenSeadragon.Point(0.5 - viewer.viewport.getBounds().width/2,
|
var target = new OpenSeadragon.Point(0.5 - viewer.viewport.getBounds().width / 2,
|
||||||
1/viewer.source.aspectRatio/2 - viewer.viewport.getBounds().height/2);
|
1 / viewer.source.aspectRatio / 2 - viewer.viewport.getBounds().height / 2);
|
||||||
var delta = target.minus(start);
|
var delta = target.minus(start);
|
||||||
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 * widthOfViewerContentOnNavigator, delta.y * heightOfViewerContentOnNavigator);
|
||||||
@ -302,34 +272,43 @@ QUnit.config.autostart = false;
|
|||||||
seadragonProperties.visibilityRatio = 1;
|
seadragonProperties.visibilityRatio = 1;
|
||||||
viewer = OpenSeadragon(seadragonProperties);
|
viewer = OpenSeadragon(seadragonProperties);
|
||||||
|
|
||||||
var navigatorInteractionOperations = [ clickOnNavigator("TOPRIGHT"),dragNavigatorBackToCenter,
|
var navigatorOperationScenarios = [
|
||||||
clickOnNavigator("BOTTOMLEFT"),dragNavigatorBackToCenter,
|
{interactionOperation:clickOnNavigator("TOPRIGHT"),
|
||||||
clickOnNavigator("BOTTOMRIGHT"),dragNavigatorBackToCenter,
|
assessmentOperation:assessViewerInCorner("TOPRIGHT"),
|
||||||
clickOnNavigator("TOPLEFT"),dragNavigatorBackToCenter ];
|
assessmentMessage:"After click on navigator on top right" },
|
||||||
var navigatorAssessmentOperations = [assessViewerInCorner("TOPRIGHT"),assessViewerInCenter,
|
{interactionOperation:dragNavigatorBackToCenter,
|
||||||
assessViewerInCorner("BOTTOMLEFT"),assessViewerInCenter,
|
assessmentOperation:assessViewerInCenter,
|
||||||
assessViewerInCorner("BOTTOMRIGHT"),assessViewerInCenter,
|
assessmentMessage:"After drag on navigator from top right" },
|
||||||
assessViewerInCorner("TOPLEFT"),assessViewerInCenter];
|
{interactionOperation:clickOnNavigator("BOTTOMLEFT"),
|
||||||
|
assessmentOperation:assessViewerInCorner("BOTTOMLEFT"),
|
||||||
|
assessmentMessage:"After click on navigator on bottom left" },
|
||||||
|
{interactionOperation:dragNavigatorBackToCenter,
|
||||||
|
assessmentOperation:assessViewerInCenter,
|
||||||
|
assessmentMessage:"After drag on navigator from bottom left" },
|
||||||
|
{interactionOperation:clickOnNavigator("BOTTOMRIGHT"),
|
||||||
|
assessmentOperation:assessViewerInCorner("BOTTOMRIGHT"),
|
||||||
|
assessmentMessage:"After click on navigator on bottom right" },
|
||||||
|
{interactionOperation:dragNavigatorBackToCenter,
|
||||||
|
assessmentOperation:assessViewerInCenter,
|
||||||
|
assessmentMessage:"After drag on navigator from bottom right" },
|
||||||
|
{interactionOperation:clickOnNavigator("TOPLEFT"),
|
||||||
|
assessmentOperation:assessViewerInCorner("TOPLEFT"),
|
||||||
|
assessmentMessage:"After click on navigator on top left" },
|
||||||
|
{interactionOperation:dragNavigatorBackToCenter,
|
||||||
|
assessmentOperation:assessViewerInCenter,
|
||||||
|
assessmentMessage:"After drag on navigator from top left" }
|
||||||
|
];
|
||||||
|
|
||||||
var navigatorAssessmentMessages = ["After click on navigator on top right","After drag on navigator from top right",
|
var assessNavigatorOperationAndTakeNextStep = function (step) {
|
||||||
"After click on navigator on bottom left","After drag on navigator from bottom left",
|
return function () {
|
||||||
"After click on navigator on bottom right","After drag on navigator from bottom right",
|
var nextStep = step + 1;
|
||||||
"After click on navigator on top right","After drag on navigator from top right"];
|
assessNavigatorDisplayRegionAndMainViewerState(navigatorOperationScenarios[step].assessmentMessage);
|
||||||
|
navigatorOperationScenarios[step].assessmentOperation();
|
||||||
var assessNavigatorOperationAndTakeNextStep = function(step)
|
if (step === navigatorOperationScenarios.length - 1) {
|
||||||
{
|
|
||||||
return function()
|
|
||||||
{
|
|
||||||
var nextStep = step+1;
|
|
||||||
assessNavigatorDisplayRegionAndMainViewerState(navigatorAssessmentMessages[step]);
|
|
||||||
navigatorAssessmentOperations[step]();
|
|
||||||
if (step === navigatorInteractionOperations.length-1)
|
|
||||||
{
|
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
navigatorOperationScenarios[nextStep].interactionOperation();
|
||||||
navigatorInteractionOperations[nextStep]();
|
|
||||||
waitForViewer(assessNavigatorOperationAndTakeNextStep(nextStep));
|
waitForViewer(assessNavigatorOperationAndTakeNextStep(nextStep));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -337,7 +316,7 @@ QUnit.config.autostart = false;
|
|||||||
|
|
||||||
var assessAfterDragOnViewer = function () {
|
var assessAfterDragOnViewer = function () {
|
||||||
assessNavigatorDisplayRegionAndMainViewerState("After pan");
|
assessNavigatorDisplayRegionAndMainViewerState("After pan");
|
||||||
navigatorInteractionOperations[0]();
|
navigatorOperationScenarios[0].interactionOperation();
|
||||||
waitForViewer(assessNavigatorOperationAndTakeNextStep(0));
|
waitForViewer(assessNavigatorOperationAndTakeNextStep(0));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user