mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 21:26:10 +03:00
Added autohide tests
This commit is contained in:
parent
50a9cecd35
commit
d34a912a13
@ -336,91 +336,43 @@ QUnit.config.autostart = false;
|
|||||||
waitForViewer(assessAfterZoomOnViewer);
|
waitForViewer(assessAfterZoomOnViewer);
|
||||||
};
|
};
|
||||||
|
|
||||||
var openHandler = function () {
|
var assessAutohideTriggered = function () {
|
||||||
viewer.removeHandler('open', openHandler);
|
ok($(testProperties.navigatorLocator).parent().css("opacity") == 0);
|
||||||
waitForViewer(captureInitialStateAfterOpenAndThenAct);
|
waitForViewer(captureInitialStateAfterOpenAndThenAct);
|
||||||
};
|
};
|
||||||
|
|
||||||
viewer.addHandler('open', openHandler);
|
var assessAutohideDisabled = function () {
|
||||||
|
ok($(testProperties.navigatorLocator).parent().css("opacity") > 0);
|
||||||
|
waitForViewer(captureInitialStateAfterOpenAndThenAct);
|
||||||
};
|
};
|
||||||
|
|
||||||
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());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
asyncTest('DefaultNavigatorLocation', function () {
|
var openHandler = function () {
|
||||||
assessNavigatorViewerPlacement({
|
viewer.removeHandler('open', openHandler);
|
||||||
id:'example',
|
if (!testProperties.testAutohide)
|
||||||
prefixUrl:'/build/openseadragon/images/',
|
|
||||||
tileSources:'/test/data/testpattern.dzi',
|
|
||||||
showNavigator:true
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
displayRegionLocator:'.navigator .displayregion',
|
waitForViewer(captureInitialStateAfterOpenAndThenAct);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
});
|
else
|
||||||
});
|
|
||||||
|
|
||||||
asyncTest('NavigatorOnJQueryDialog', function () {
|
|
||||||
$('#exampleNavigator').dialog();
|
|
||||||
assessNavigatorViewerPlacement({
|
|
||||||
id:'example',
|
|
||||||
navigatorId:'exampleNavigator',
|
|
||||||
prefixUrl:'/build/openseadragon/images/',
|
|
||||||
tileSources:'/test/data/testpattern.dzi',
|
|
||||||
showNavigator:true
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
displayRegionLocator:'#exampleNavigator .displayregion',
|
ok($(testProperties.navigatorLocator).parent().css("opacity") > 0);
|
||||||
navigatorLocator:'#exampleNavigator',
|
var event = {
|
||||||
determineExpectationsAndAssessNavigatorLocation:function (seadragonProperties, testProperties) {
|
clientX:1,
|
||||||
var jqueryDialog = $(testProperties.navigatorLocator);
|
clientY:1
|
||||||
assessNavigatorLocation(jqueryDialog.offset().left,
|
};
|
||||||
jqueryDialog.offset().top);
|
var body = $("body").simulate('mouseover', event);
|
||||||
}
|
if (testProperties.expectedAutoHide)
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
asyncTest('DefaultNavigatorLocationWithWideImageSquareViewer', function () {
|
|
||||||
assessNavigatorViewerPlacement({
|
|
||||||
id:'example',
|
|
||||||
prefixUrl:'/build/openseadragon/images/',
|
|
||||||
tileSources:'/test/data/wide.dzi',
|
|
||||||
showNavigator:true
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
displayRegionLocator:'.navigator .displayregion',
|
setTimeout(assessAutohideTriggered,5000);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
});
|
else
|
||||||
});
|
{
|
||||||
|
setTimeout(assessAutohideDisabled,5000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
viewer.addHandler('open', openHandler);
|
||||||
|
};
|
||||||
|
|
||||||
asyncTest('DefaultNavigatorLocationWithWideImageTallViewer', function () {
|
asyncTest('DefaultNavigatorLocationWithWideImageTallViewer', function () {
|
||||||
assessNavigatorViewerPlacement({
|
assessNavigatorViewerPlacement({
|
||||||
@ -432,6 +384,8 @@ QUnit.config.autostart = false;
|
|||||||
{
|
{
|
||||||
displayRegionLocator:'.navigator .displayregion',
|
displayRegionLocator:'.navigator .displayregion',
|
||||||
navigatorLocator:'.navigator',
|
navigatorLocator:'.navigator',
|
||||||
|
testAutohide: false,
|
||||||
|
expectedAutoHide: false,
|
||||||
determineExpectationsAndAssessNavigatorLocation:function (seadragonProperties, testProperties) {
|
determineExpectationsAndAssessNavigatorLocation:function (seadragonProperties, testProperties) {
|
||||||
var mainViewerElement = $("#" + seadragonProperties.id);
|
var mainViewerElement = $("#" + seadragonProperties.id);
|
||||||
var navigatorElement = $(testProperties.navigatorLocator);
|
var navigatorElement = $(testProperties.navigatorLocator);
|
||||||
@ -441,59 +395,46 @@ QUnit.config.autostart = false;
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
asyncTest('DefaultNavigatorLocationWithWideImageWideViewer', function () {
|
asyncTest('CustomNavigatorLocationWithWideImageWideViewer', function () {
|
||||||
assessNavigatorViewerPlacement({
|
assessNavigatorViewerPlacement({
|
||||||
id:'wideexample',
|
id:'wideexample',
|
||||||
|
navigatorId:'exampleNavigator',
|
||||||
prefixUrl:'/build/openseadragon/images/',
|
prefixUrl:'/build/openseadragon/images/',
|
||||||
tileSources:'/test/data/wide.dzi',
|
tileSources:'/test/data/wide.dzi',
|
||||||
showNavigator:true
|
showNavigator:true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayRegionLocator:'.navigator .displayregion',
|
displayRegionLocator:'#exampleNavigator .displayregion',
|
||||||
navigatorLocator:'.navigator',
|
navigatorLocator:'#exampleNavigator',
|
||||||
|
testAutohide: false,
|
||||||
|
expectedAutoHide: true,
|
||||||
determineExpectationsAndAssessNavigatorLocation:function (seadragonProperties, testProperties) {
|
determineExpectationsAndAssessNavigatorLocation:function (seadragonProperties, testProperties) {
|
||||||
var mainViewerElement = $("#" + seadragonProperties.id);
|
var mainViewerElement = $("#" + seadragonProperties.id);
|
||||||
var navigatorElement = $(testProperties.navigatorLocator);
|
var navigatorViewerElement = $("#" + seadragonProperties.navigatorId);
|
||||||
assessNavigatorLocation(mainViewerElement.offset().left + mainViewerElement.width() - navigatorElement.width(),
|
assessNavigatorLocation(mainViewerElement.offset().left,
|
||||||
mainViewerElement.offset().top);
|
mainViewerElement.offset().top - navigatorViewerElement.parent().height());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
asyncTest('DefaultNavigatorLocationWithTallImageSquareViewer', function () {
|
asyncTest('CustomDialogNavigatorLocationWithTallImageTallViewer', function () {
|
||||||
assessNavigatorViewerPlacement({
|
$('#exampleNavigator').dialog();
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
asyncTest('DefaultNavigatorLocationWithTallImageTallViewer', function () {
|
|
||||||
assessNavigatorViewerPlacement({
|
assessNavigatorViewerPlacement({
|
||||||
id:'tallexample',
|
id:'tallexample',
|
||||||
|
navigatorId:'exampleNavigator',
|
||||||
prefixUrl:'/build/openseadragon/images/',
|
prefixUrl:'/build/openseadragon/images/',
|
||||||
tileSources:'/test/data/tall.dzi',
|
tileSources:'/test/data/tall.dzi',
|
||||||
showNavigator:true
|
showNavigator:true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayRegionLocator:'.navigator .displayregion',
|
displayRegionLocator:'#exampleNavigator .displayregion',
|
||||||
navigatorLocator:'.navigator',
|
navigatorLocator:'#exampleNavigator',
|
||||||
|
testAutohide: true,
|
||||||
|
expectedAutoHide: false,
|
||||||
determineExpectationsAndAssessNavigatorLocation:function (seadragonProperties, testProperties) {
|
determineExpectationsAndAssessNavigatorLocation:function (seadragonProperties, testProperties) {
|
||||||
var mainViewerElement = $("#" + seadragonProperties.id);
|
var jqueryDialog = $(testProperties.navigatorLocator);
|
||||||
var navigatorElement = $(testProperties.navigatorLocator);
|
assessNavigatorLocation(jqueryDialog.offset().left,
|
||||||
assessNavigatorLocation(mainViewerElement.offset().left + mainViewerElement.width() - navigatorElement.width(),
|
jqueryDialog.offset().top);
|
||||||
mainViewerElement.offset().top);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -508,6 +449,8 @@ QUnit.config.autostart = false;
|
|||||||
{
|
{
|
||||||
displayRegionLocator:'.navigator .displayregion',
|
displayRegionLocator:'.navigator .displayregion',
|
||||||
navigatorLocator:'.navigator',
|
navigatorLocator:'.navigator',
|
||||||
|
testAutohide: true,
|
||||||
|
expectedAutoHide: true,
|
||||||
determineExpectationsAndAssessNavigatorLocation:function (seadragonProperties, testProperties) {
|
determineExpectationsAndAssessNavigatorLocation:function (seadragonProperties, testProperties) {
|
||||||
var mainViewerElement = $("#" + seadragonProperties.id);
|
var mainViewerElement = $("#" + seadragonProperties.id);
|
||||||
var navigatorElement = $(testProperties.navigatorLocator);
|
var navigatorElement = $(testProperties.navigatorLocator);
|
||||||
@ -517,17 +460,4 @@ QUnit.config.autostart = false;
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//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 approach
|
|
||||||
//Test autohide
|
|
||||||
//Operate on the navigator
|
|
||||||
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user