2013-03-21 21:55:36 +04:00
|
|
|
QUnit.config.autostart = false;
|
|
|
|
|
2013-03-24 05:06:38 +04:00
|
|
|
(function () {
|
2013-03-21 21:55:36 +04:00
|
|
|
var viewer = null;
|
|
|
|
|
2013-03-24 05:06:38 +04:00
|
|
|
$(document).ready(function () {
|
2013-03-21 21:55:36 +04:00
|
|
|
start();
|
|
|
|
});
|
|
|
|
|
2013-03-24 05:06:38 +04:00
|
|
|
var assessNumericValueWithSomeVariance = function (value1, value2, variance, message) {
|
|
|
|
var varianceAsPortionOfTargetValue = Math.max(.03, Math.abs(value1 * variance));
|
|
|
|
ok(Math.abs(value1 - value2) <= varianceAsPortionOfTargetValue, message + " Expected:" + value1 + " Found: " + value2 + " Variance: " + varianceAsPortionOfTargetValue);
|
2013-03-21 21:55:36 +04:00
|
|
|
};
|
|
|
|
|
2013-03-25 19:01:31 +04:00
|
|
|
var assessNumericValueWithFixedVariance = function (value1, value2, variance, message) {
|
|
|
|
ok(Math.abs(value1 - value2) <= variance, message + " Expected:" + value1 + " Found: " + value2 + " Variance: " + variance);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-03-24 05:06:38 +04:00
|
|
|
var assessNavigatorLocation = function (expectedX, expectedY) {
|
|
|
|
var navigator = $(".navigator");
|
2013-03-21 21:55:36 +04:00
|
|
|
|
2013-03-24 05:06:38 +04:00
|
|
|
assessNumericValueWithSomeVariance(expectedX, navigator.offset().left, .1, ' Navigator x position');
|
|
|
|
assessNumericValueWithSomeVariance(expectedY, navigator.offset().top, .1, ' Navigator y position');
|
2013-03-21 21:55:36 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-03-24 05:06:38 +04:00
|
|
|
var assessNavigatorDisplayRegionAndMainViewerState = function (theViewer, theDisplayRegionSelector, status) {
|
|
|
|
|
|
|
|
var displayRegion = $(theDisplayRegionSelector);
|
2013-03-21 21:55:36 +04:00
|
|
|
var mainViewerBounds = theViewer.viewport.getBounds();
|
2013-03-24 05:06:38 +04:00
|
|
|
|
|
|
|
var displayTopLeftLocationInPixels = new OpenSeadragon.Point(displayRegion.position().left, displayRegion.position().top);
|
|
|
|
var displayRegionDimensionsInPixels = new OpenSeadragon.Point((displayRegion.width()),(displayRegion.height()))
|
2013-03-24 07:06:34 +04:00
|
|
|
.plus(theViewer.navigator.totalBorderWidths);
|
2013-03-24 05:06:38 +04:00
|
|
|
var displayBottomRightLocationInPixels = displayTopLeftLocationInPixels.plus(displayRegionDimensionsInPixels);
|
|
|
|
|
|
|
|
var displayLocationInPoints = theViewer.navigator.viewport.pointFromPixel(displayTopLeftLocationInPixels);
|
|
|
|
var displayRegionDimensionsInPoints = theViewer.navigator.viewport.pointFromPixel(displayBottomRightLocationInPixels).minus(displayLocationInPoints);
|
2013-03-21 21:55:36 +04:00
|
|
|
|
2013-03-25 19:01:31 +04:00
|
|
|
//Begin Experiment
|
|
|
|
|
|
|
|
var navigator = $(".navigator");
|
|
|
|
var mainContainer = $(theViewer.container);
|
|
|
|
var maxHeightFactor = 1;
|
|
|
|
var navigatorAspectRatio = navigator.height() /navigator.width();
|
|
|
|
var spaceFromLeftEdgeOfViewerToContentStart = 0;
|
|
|
|
var spaceFromTopEdgeOfViewerToContentStart = 0;
|
|
|
|
var leftScalingFactor = navigatorAspectRatio * theViewer.source.aspectRatio;
|
|
|
|
if (theViewer.source.aspectRatio < 1)
|
|
|
|
{
|
|
|
|
//TALL
|
|
|
|
if (theViewer.source.aspectRatio < navigatorAspectRatio)
|
|
|
|
{
|
|
|
|
maxHeightFactor = theViewer.source.aspectRatio * navigatorAspectRatio;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
maxHeightFactor = theViewer.source.aspectRatio;
|
|
|
|
}
|
|
|
|
spaceFromLeftEdgeOfViewerToContentStart = ((1/maxHeightFactor)-1) / 2 * maxHeightFactor * navigator.width();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (theViewer.source.aspectRatio < navigatorAspectRatio)
|
|
|
|
{
|
|
|
|
spaceFromTopEdgeOfViewerToContentStart = (navigatorAspectRatio - (1/theViewer.source.aspectRatio)) / 2 /navigatorAspectRatio * navigator.height();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
spaceFromTopEdgeOfViewerToContentStart = (navigatorAspectRatio - (1/theViewer.source.aspectRatio)) / 2 /navigatorAspectRatio * navigator.height();
|
|
|
|
leftScalingFactor = 1;
|
|
|
|
}
|
|
|
|
// spaceFromTopEdgeOfViewerToContentStart = (1 - (1/theViewer.source.aspectRatio)) / 2 * (1-(1/theViewer.source.aspectRatio)) * navigator.height();
|
|
|
|
}
|
|
|
|
|
|
|
|
var expectedDisplayRegionWidth = navigator.width() / theViewer.viewport.getZoom() * maxHeightFactor;
|
|
|
|
var expectedDisplayRegionHeight = navigator.height() / theViewer.viewport.getZoom() * maxHeightFactor;
|
|
|
|
|
|
|
|
var expectedDisplayRegionXLocation = mainViewerBounds.x * maxHeightFactor * navigator.width() + spaceFromLeftEdgeOfViewerToContentStart;
|
|
|
|
// var expectedDisplayRegionYLocation = mainViewerBounds.y * (1/theViewer.source.aspectRatio) * navigator.width() + spaceFromTopEdgeOfViewerToContentStart ;
|
|
|
|
var expectedDisplayRegionYLocation = mainViewerBounds.y * leftScalingFactor * navigator.width() + spaceFromTopEdgeOfViewerToContentStart ; //navigatorAspectRatio * theViewer.source.aspectRatio
|
|
|
|
|
|
|
|
assessNumericValueWithFixedVariance(expectedDisplayRegionWidth, displayRegionDimensionsInPixels.x, 2, status + ' Experimental Width synchronization');
|
|
|
|
assessNumericValueWithFixedVariance(expectedDisplayRegionHeight, displayRegionDimensionsInPixels.y, 2, status + ' Experimental Height synchronization');
|
|
|
|
|
|
|
|
assessNumericValueWithFixedVariance(expectedDisplayRegionXLocation, displayTopLeftLocationInPixels.x, 2, status + ' Experimental Left synchronization');
|
|
|
|
assessNumericValueWithFixedVariance(expectedDisplayRegionYLocation, displayTopLeftLocationInPixels.y, 2, status + ' Experimental Top synchronization');
|
|
|
|
|
|
|
|
|
|
|
|
//End Experiment
|
|
|
|
|
2013-03-24 05:06:38 +04:00
|
|
|
assessNumericValueWithSomeVariance(mainViewerBounds.width, displayRegionDimensionsInPoints.x, .05, status + ' Width synchronization');
|
|
|
|
assessNumericValueWithSomeVariance(mainViewerBounds.height, displayRegionDimensionsInPoints.y, .05, status + ' Height synchronization');
|
|
|
|
assessNumericValueWithSomeVariance(mainViewerBounds.x, displayLocationInPoints.x, .05, status + ' Left synchronization');
|
|
|
|
assessNumericValueWithSomeVariance(mainViewerBounds.y, displayLocationInPoints.y, .05, status + ' Top synchronization');
|
2013-03-21 21:55:36 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
var filterToDetectThatDisplayRegionHasBeenDrawn = function () {
|
|
|
|
var self = $(this);
|
|
|
|
return self.width() > 0 &&
|
|
|
|
self.height() > 0 &&
|
2013-03-24 05:06:38 +04:00
|
|
|
(typeof self.position() !== 'undefined');
|
2013-03-21 21:55:36 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
var waitUntilFilterSatisfied = function () {
|
|
|
|
return function () {
|
|
|
|
return function (selector, filterfunction, handler, recursiveCall, count) {
|
2013-03-24 05:06:38 +04:00
|
|
|
var found;
|
|
|
|
if (recursiveCall !== true) {
|
2013-03-21 21:55:36 +04:00
|
|
|
count = 0;
|
|
|
|
}
|
|
|
|
var $this = $(selector).filter(filterfunction);
|
|
|
|
found = found || $this.length > 0;
|
2013-03-24 05:06:38 +04:00
|
|
|
if (!found && count < 20) {
|
2013-03-21 21:55:36 +04:00
|
|
|
setTimeout(function () {
|
|
|
|
count++;
|
|
|
|
waitUntilFilterSatisfied(selector, filterfunction, handler, true, count);
|
|
|
|
}, 50)
|
|
|
|
}
|
|
|
|
else {
|
2013-03-24 05:06:38 +04:00
|
|
|
handler();
|
2013-03-21 21:55:36 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}();
|
|
|
|
}();
|
|
|
|
|
2013-03-24 05:06:38 +04:00
|
|
|
var waitForViewer = function () {
|
2013-03-21 21:55:36 +04:00
|
|
|
return function () {
|
2013-03-24 05:06:38 +04:00
|
|
|
return function (theViewer, handler, targetPropery, viewportFunctionToInspectTargetProperty, recursiveCall, count) {
|
|
|
|
var propertyAchieved = false;
|
|
|
|
if (recursiveCall !== true) {
|
2013-03-21 21:55:36 +04:00
|
|
|
count = 0;
|
|
|
|
}
|
2013-03-24 05:06:38 +04:00
|
|
|
if (typeof viewportFunctionToInspectTargetProperty === "function") {
|
|
|
|
try
|
|
|
|
{
|
|
|
|
propertyAchieved = targetPropery === viewportFunctionToInspectTargetProperty.call(theViewer.viewport, true);
|
|
|
|
}
|
|
|
|
catch(err)
|
|
|
|
{
|
|
|
|
//Ignore. Subsequent code will try again shortly
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((theViewer.drawer === null || theViewer.drawer.needsUpdate() || !propertyAchieved) && count < 40) {
|
2013-03-21 21:55:36 +04:00
|
|
|
count++;
|
2013-03-24 05:06:38 +04:00
|
|
|
setTimeout(function () {
|
|
|
|
waitForViewer(theViewer, handler, targetPropery, viewportFunctionToInspectTargetProperty, true, count);
|
2013-03-21 21:55:36 +04:00
|
|
|
}, 50)
|
|
|
|
}
|
|
|
|
else {
|
2013-03-24 05:06:38 +04:00
|
|
|
handler();
|
2013-03-21 21:55:36 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}();
|
|
|
|
}();
|
|
|
|
|
2013-03-24 05:06:38 +04:00
|
|
|
var assessNavigatorViewerPlacement = function (seadragonProperties, testProperties) {
|
|
|
|
viewer = OpenSeadragon(seadragonProperties);
|
2013-03-21 21:55:36 +04:00
|
|
|
|
|
|
|
var assessNavigatorAfterDrag = function () {
|
2013-03-24 05:06:38 +04:00
|
|
|
assessNavigatorDisplayRegionAndMainViewerState(viewer, testProperties.displayRegionLocator, "After pan");
|
2013-03-21 21:55:36 +04:00
|
|
|
start();
|
|
|
|
};
|
|
|
|
|
|
|
|
var assessNavigatorAfterZoom = function () {
|
2013-03-24 05:06:38 +04:00
|
|
|
var target = new OpenSeadragon.Point(0.4, 0.4);
|
|
|
|
assessNavigatorDisplayRegionAndMainViewerState(viewer, testProperties.displayRegionLocator, "After image zoom");
|
|
|
|
viewer.viewport.panTo(target);
|
|
|
|
waitForViewer(viewer, assessNavigatorAfterDrag, target, viewer.viewport.getCenter);
|
2013-03-21 21:55:36 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
var captureInitialStateAfterOpenAndThenAct = function () {
|
2013-03-24 05:06:38 +04:00
|
|
|
assessNavigatorDisplayRegionAndMainViewerState(viewer, testProperties.displayRegionLocator, "After image load");
|
2013-03-21 21:55:36 +04:00
|
|
|
|
2013-03-24 05:06:38 +04:00
|
|
|
testProperties.determineExpectationsAndAssessNavigatorLocation(seadragonProperties, testProperties);
|
2013-03-21 21:55:36 +04:00
|
|
|
|
2013-03-24 05:06:38 +04:00
|
|
|
viewer.viewport.zoomTo(viewer.viewport.getZoom() * 2);
|
|
|
|
waitForViewer(viewer, assessNavigatorAfterZoom, 2, viewer.viewport.getZoom);
|
2013-03-21 21:55:36 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
var proceedOnceTheIntialImagesAreLoaded = function () {
|
2013-03-24 05:06:38 +04:00
|
|
|
waitUntilFilterSatisfied(testProperties.displayRegionLocator, filterToDetectThatDisplayRegionHasBeenDrawn, captureInitialStateAfterOpenAndThenAct);
|
2013-03-21 21:55:36 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
var waitForNavigator = function () {
|
2013-03-24 05:06:38 +04:00
|
|
|
waitForViewer(viewer.navigator, proceedOnceTheIntialImagesAreLoaded);
|
2013-03-21 21:55:36 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
var openHandler = function () {
|
2013-03-24 05:06:38 +04:00
|
|
|
viewer.removeHandler('open', openHandler);
|
|
|
|
waitForViewer(viewer, waitForNavigator);
|
2013-03-21 21:55:36 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
viewer.addHandler('open', openHandler);
|
|
|
|
|
2013-03-24 05:06:38 +04:00
|
|
|
};
|
2013-03-21 21:55:36 +04:00
|
|
|
|
2013-03-24 05:06:38 +04:00
|
|
|
module("navigator", {
|
|
|
|
setup:function () {
|
|
|
|
//TODO This is alonger than is ideal so the tests will pass cleanly under Safari
|
|
|
|
QUnit.config.testTimeout = 20000;
|
|
|
|
if (viewer != null) {
|
|
|
|
viewer.close();
|
|
|
|
}
|
|
|
|
if ($('#exampleNavigator').is(':ui-dialog')) {
|
|
|
|
$('#exampleNavigator').dialog('destroy');
|
|
|
|
}
|
|
|
|
$("#exampleNavigator").remove();
|
|
|
|
$(".navigator").remove();
|
|
|
|
$("#example").empty();
|
|
|
|
$("#tallexample").empty();
|
|
|
|
$("#wideexample").empty();
|
|
|
|
$("#example").parent().append('<div id="exampleNavigator"></div>');
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
2013-03-21 21:55:36 +04:00
|
|
|
|
2013-03-24 05:06:38 +04:00
|
|
|
asyncTest('ZoomAndDragOnCustomNavigatorLocation', function () {
|
|
|
|
assessNavigatorViewerPlacement({
|
|
|
|
id:'example',
|
|
|
|
navigatorId:'exampleNavigator',
|
|
|
|
prefixUrl:'/build/openseadragon/images/',
|
|
|
|
tileSources:'/test/data/testpattern.dzi',
|
|
|
|
showNavigator:true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayRegionLocator:'#exampleNavigator .displayregion',
|
|
|
|
navigatorLocator:'#exampleNavigator',
|
|
|
|
determineExpectationsAndAssessNavigatorLocation:function (seadragonProperties, testProperties) {
|
|
|
|
var mainViewerElement = $("#" + seadragonProperties.id);
|
|
|
|
assessNavigatorLocation(mainViewerElement.offset().left,
|
|
|
|
mainViewerElement.offset().top + mainViewerElement.height());
|
|
|
|
}
|
|
|
|
});
|
2013-03-21 21:55:36 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
asyncTest('DefaultNavigatorLocation', function () {
|
2013-03-24 05:06:38 +04:00
|
|
|
assessNavigatorViewerPlacement({
|
|
|
|
id:'example',
|
|
|
|
prefixUrl:'/build/openseadragon/images/',
|
|
|
|
tileSources:'/test/data/testpattern.dzi',
|
|
|
|
showNavigator:true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayRegionLocator:'.navigator .displayregion',
|
|
|
|
navigatorLocator:'.navigator',
|
|
|
|
determineExpectationsAndAssessNavigatorLocation:function (seadragonProperties, testProperties) {
|
|
|
|
var mainViewerElement = $("#" + seadragonProperties.id);
|
|
|
|
var navigatorElement = $(testProperties.navigatorLocator);
|
|
|
|
assessNavigatorLocation(mainViewerElement.offset().left + mainViewerElement.width() - navigatorElement.width(),
|
|
|
|
mainViewerElement.offset().top);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2013-03-21 21:55:36 +04:00
|
|
|
|
2013-03-24 05:06:38 +04:00
|
|
|
asyncTest('NavigatorOnJQueryDialog', function () {
|
|
|
|
assessNavigatorViewerPlacement({
|
|
|
|
id:'example',
|
|
|
|
navigatorId:'exampleNavigator',
|
|
|
|
prefixUrl:'/build/openseadragon/images/',
|
|
|
|
tileSources:'/test/data/testpattern.dzi',
|
|
|
|
showNavigator:true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayRegionLocator:'#exampleNavigator .displayregion',
|
|
|
|
navigatorLocator:'#exampleNavigator',
|
|
|
|
determineExpectationsAndAssessNavigatorLocation:function (seadragonProperties, testProperties) {
|
|
|
|
var jqueryDialog = $(testProperties.navigatorLocator);
|
|
|
|
assessNavigatorLocation(jqueryDialog.offset().left,
|
|
|
|
jqueryDialog.offset().top);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2013-03-21 21:55:36 +04:00
|
|
|
|
2013-03-24 05:06:38 +04:00
|
|
|
asyncTest('DefaultNavigatorLocationWithWideImageSquareViewer', function () {
|
|
|
|
assessNavigatorViewerPlacement({
|
|
|
|
id:'example',
|
|
|
|
prefixUrl:'/build/openseadragon/images/',
|
|
|
|
tileSources:'/test/data/wide.dzi',
|
|
|
|
showNavigator:true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayRegionLocator:'.navigator .displayregion',
|
|
|
|
navigatorLocator:'.navigator',
|
|
|
|
determineExpectationsAndAssessNavigatorLocation:function (seadragonProperties, testProperties) {
|
|
|
|
var mainViewerElement = $("#" + seadragonProperties.id);
|
|
|
|
var navigatorElement = $(testProperties.navigatorLocator);
|
|
|
|
assessNavigatorLocation(mainViewerElement.offset().left + mainViewerElement.width() - navigatorElement.width(),
|
|
|
|
mainViewerElement.offset().top);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2013-03-21 21:55:36 +04:00
|
|
|
|
2013-03-24 05:06:38 +04:00
|
|
|
asyncTest('DefaultNavigatorLocationWithWideImageTallViewer', function () {
|
|
|
|
assessNavigatorViewerPlacement({
|
|
|
|
id:'tallexample',
|
|
|
|
prefixUrl:'/build/openseadragon/images/',
|
|
|
|
tileSources:'/test/data/wide.dzi',
|
|
|
|
showNavigator:true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayRegionLocator:'.navigator .displayregion',
|
|
|
|
navigatorLocator:'.navigator',
|
|
|
|
determineExpectationsAndAssessNavigatorLocation:function (seadragonProperties, testProperties) {
|
|
|
|
var mainViewerElement = $("#" + seadragonProperties.id);
|
|
|
|
var navigatorElement = $(testProperties.navigatorLocator);
|
|
|
|
assessNavigatorLocation(mainViewerElement.offset().left + mainViewerElement.width() - navigatorElement.width(),
|
|
|
|
mainViewerElement.offset().top);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2013-03-21 21:55:36 +04:00
|
|
|
|
2013-03-24 05:06:38 +04:00
|
|
|
asyncTest('DefaultNavigatorLocationWithWideImageWideViewer', function () {
|
|
|
|
assessNavigatorViewerPlacement({
|
|
|
|
id:'wideexample',
|
|
|
|
prefixUrl:'/build/openseadragon/images/',
|
|
|
|
tileSources:'/test/data/wide.dzi',
|
|
|
|
showNavigator:true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayRegionLocator:'.navigator .displayregion',
|
|
|
|
navigatorLocator:'.navigator',
|
|
|
|
determineExpectationsAndAssessNavigatorLocation:function (seadragonProperties, testProperties) {
|
|
|
|
var mainViewerElement = $("#" + seadragonProperties.id);
|
|
|
|
var navigatorElement = $(testProperties.navigatorLocator);
|
|
|
|
assessNavigatorLocation(mainViewerElement.offset().left + mainViewerElement.width() - navigatorElement.width(),
|
|
|
|
mainViewerElement.offset().top);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2013-03-21 21:55:36 +04:00
|
|
|
|
2013-03-24 05:06:38 +04:00
|
|
|
asyncTest('DefaultNavigatorLocationWithTallImageSquareViewer', function () {
|
|
|
|
assessNavigatorViewerPlacement({
|
|
|
|
id:'example',
|
|
|
|
prefixUrl:'/build/openseadragon/images/',
|
|
|
|
tileSources:'/test/data/tall.dzi',
|
|
|
|
showNavigator:true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayRegionLocator:'.navigator .displayregion',
|
|
|
|
navigatorLocator:'.navigator',
|
|
|
|
determineExpectationsAndAssessNavigatorLocation:function (seadragonProperties, testProperties) {
|
|
|
|
var mainViewerElement = $("#" + seadragonProperties.id);
|
|
|
|
var navigatorElement = $(testProperties.navigatorLocator);
|
|
|
|
assessNavigatorLocation(mainViewerElement.offset().left + mainViewerElement.width() - navigatorElement.width(),
|
|
|
|
mainViewerElement.offset().top);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2013-03-21 21:55:36 +04:00
|
|
|
|
2013-03-25 19:01:31 +04:00
|
|
|
asyncTest('DefaultNavigatorLocationWithTallImageTallViewer', function () {
|
2013-03-24 05:06:38 +04:00
|
|
|
assessNavigatorViewerPlacement({
|
|
|
|
id:'tallexample',
|
|
|
|
prefixUrl:'/build/openseadragon/images/',
|
|
|
|
tileSources:'/test/data/tall.dzi',
|
|
|
|
showNavigator:true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayRegionLocator:'.navigator .displayregion',
|
|
|
|
navigatorLocator:'.navigator',
|
|
|
|
determineExpectationsAndAssessNavigatorLocation:function (seadragonProperties, testProperties) {
|
|
|
|
var mainViewerElement = $("#" + seadragonProperties.id);
|
|
|
|
var navigatorElement = $(testProperties.navigatorLocator);
|
|
|
|
assessNavigatorLocation(mainViewerElement.offset().left + mainViewerElement.width() - navigatorElement.width(),
|
|
|
|
mainViewerElement.offset().top);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2013-03-21 21:55:36 +04:00
|
|
|
|
2013-03-24 05:06:38 +04:00
|
|
|
asyncTest('DefaultNavigatorLocationWithTallImageWideViewer', function () {
|
|
|
|
assessNavigatorViewerPlacement({
|
|
|
|
id:'wideexample',
|
|
|
|
prefixUrl:'/build/openseadragon/images/',
|
|
|
|
tileSources:'/test/data/tall.dzi',
|
|
|
|
showNavigator:true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayRegionLocator:'.navigator .displayregion',
|
|
|
|
navigatorLocator:'.navigator',
|
|
|
|
determineExpectationsAndAssessNavigatorLocation:function (seadragonProperties, testProperties) {
|
|
|
|
var mainViewerElement = $("#" + seadragonProperties.id);
|
|
|
|
var navigatorElement = $(testProperties.navigatorLocator);
|
|
|
|
assessNavigatorLocation(mainViewerElement.offset().left + mainViewerElement.width() - navigatorElement.width(),
|
|
|
|
mainViewerElement.offset().top);
|
|
|
|
}
|
|
|
|
});
|
2013-03-21 21:55:36 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//Try with different navigator locations, in a jquery dialog and in a default location
|
|
|
|
//Test whether showNavigator works
|
|
|
|
//Test whether the initial locations works
|
|
|
|
|
|
|
|
//Other tests that require additional sample images
|
|
|
|
//Switch content, make sure things work
|
|
|
|
|
|
|
|
//Other tests that require a reasonable event simulation approachj
|
|
|
|
//Test autohide
|
|
|
|
//Operate on the navigator
|
|
|
|
|
|
|
|
|
|
|
|
})();
|