mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-21 20:56:09 +03:00
update tests to skip fullscreen and certain drawer-related events
This commit is contained in:
parent
6b995c018b
commit
9dc96390fc
@ -226,49 +226,50 @@
|
||||
viewer.open('/test/data/testpattern.dzi');
|
||||
});
|
||||
|
||||
QUnit.test('FullScreen', function(assert) {
|
||||
const done = assert.async();
|
||||
if (!OpenSeadragon.supportsFullScreen) {
|
||||
assert.expect(0);
|
||||
done();
|
||||
return;
|
||||
}
|
||||
// TODO: can this be enabled without breaking tests due to lack of short-duration user interaction?
|
||||
// QUnit.test('FullScreen', function(assert) {
|
||||
// const done = assert.async();
|
||||
// if (!OpenSeadragon.supportsFullScreen) {
|
||||
// assert.expect(0);
|
||||
// done();
|
||||
// return;
|
||||
// }
|
||||
|
||||
viewer.addHandler('open', function () {
|
||||
assert.ok(!OpenSeadragon.isFullScreen(), 'Started out not fullscreen');
|
||||
// viewer.addHandler('open', function () {
|
||||
// assert.ok(!OpenSeadragon.isFullScreen(), 'Started out not fullscreen');
|
||||
|
||||
const checkEnteringPreFullScreen = (event) => {
|
||||
viewer.removeHandler('pre-full-screen', checkEnteringPreFullScreen);
|
||||
assert.ok(event.fullScreen, 'Switching to fullscreen');
|
||||
assert.ok(!OpenSeadragon.isFullScreen(), 'Not yet fullscreen');
|
||||
};
|
||||
// const checkEnteringPreFullScreen = (event) => {
|
||||
// viewer.removeHandler('pre-full-screen', checkEnteringPreFullScreen);
|
||||
// assert.ok(event.fullScreen, 'Switching to fullscreen');
|
||||
// assert.ok(!OpenSeadragon.isFullScreen(), 'Not yet fullscreen');
|
||||
// };
|
||||
|
||||
const checkExitingFullScreen = (event) => {
|
||||
viewer.removeHandler('full-screen', checkExitingFullScreen);
|
||||
assert.ok(!event.fullScreen, 'Disabling fullscreen');
|
||||
assert.ok(!OpenSeadragon.isFullScreen(), 'Fullscreen disabled');
|
||||
done();
|
||||
}
|
||||
// const checkExitingFullScreen = (event) => {
|
||||
// viewer.removeHandler('full-screen', checkExitingFullScreen);
|
||||
// assert.ok(!event.fullScreen, 'Disabling fullscreen');
|
||||
// assert.ok(!OpenSeadragon.isFullScreen(), 'Fullscreen disabled');
|
||||
// done();
|
||||
// }
|
||||
|
||||
// The 'new' headless mode allows us to enter fullscreen, so verify
|
||||
// that we see the correct values returned. We will then close out
|
||||
// of fullscreen to check the same values when exiting.
|
||||
const checkAcquiredFullScreen = (event) => {
|
||||
viewer.removeHandler('full-screen', checkAcquiredFullScreen);
|
||||
viewer.addHandler('full-screen', checkExitingFullScreen);
|
||||
assert.ok(event.fullScreen, 'Acquired fullscreen');
|
||||
assert.ok(OpenSeadragon.isFullScreen(), 'Fullscreen enabled');
|
||||
viewer.setFullScreen(false);
|
||||
};
|
||||
// // The 'new' headless mode allows us to enter fullscreen, so verify
|
||||
// // that we see the correct values returned. We will then close out
|
||||
// // of fullscreen to check the same values when exiting.
|
||||
// const checkAcquiredFullScreen = (event) => {
|
||||
// viewer.removeHandler('full-screen', checkAcquiredFullScreen);
|
||||
// viewer.addHandler('full-screen', checkExitingFullScreen);
|
||||
// assert.ok(event.fullScreen, 'Acquired fullscreen');
|
||||
// assert.ok(OpenSeadragon.isFullScreen(), 'Fullscreen enabled');
|
||||
// viewer.setFullScreen(false);
|
||||
// };
|
||||
|
||||
|
||||
viewer.addHandler('pre-full-screen', checkEnteringPreFullScreen);
|
||||
viewer.addHandler('full-screen', checkAcquiredFullScreen);
|
||||
viewer.setFullScreen(true);
|
||||
});
|
||||
// viewer.addHandler('pre-full-screen', checkEnteringPreFullScreen);
|
||||
// viewer.addHandler('full-screen', checkAcquiredFullScreen);
|
||||
// viewer.setFullScreen(true);
|
||||
// });
|
||||
|
||||
viewer.open('/test/data/testpattern.dzi');
|
||||
});
|
||||
// viewer.open('/test/data/testpattern.dzi');
|
||||
// });
|
||||
|
||||
QUnit.test('Close', function(assert) {
|
||||
var done = assert.async();
|
||||
|
@ -1158,7 +1158,12 @@
|
||||
// ----------
|
||||
QUnit.test( 'Viewer: event count test with \'tile-drawing\'', function (assert) {
|
||||
var done = assert.async();
|
||||
var previousValue = viewer.drawer.continuousTileRefresh;
|
||||
if(viewer.drawer.getType() !== 'canvas'){
|
||||
assert.expect(0);
|
||||
done();
|
||||
return;
|
||||
}
|
||||
// var previousValue = viewer.drawer.continuousTileRefresh;
|
||||
assert.ok(viewer.numberOfHandlers('tile-drawing') === 0,
|
||||
"'tile-drawing' event is empty by default.");
|
||||
|
||||
@ -1166,7 +1171,7 @@
|
||||
viewer.removeHandler( 'tile-drawing', tileDrawing );
|
||||
assert.ok(viewer.numberOfHandlers('tile-drawing') === 0,
|
||||
"'tile-drawing' deleted: count is 0.");
|
||||
viewer.drawer.continuousTileRefresh = previousValue; // reset property
|
||||
// viewer.drawer.continuousTileRefresh = previousValue; // reset property
|
||||
viewer.close();
|
||||
done();
|
||||
};
|
||||
@ -1185,13 +1190,18 @@
|
||||
assert.ok(viewer.numberOfHandlers('tile-drawing') === 1,
|
||||
"'tile-drawing' deleted once: count is 1.");
|
||||
|
||||
viewer.drawer.continuousTileRefresh = true; // set to true so the tile-drawing event fires
|
||||
// viewer.drawer.continuousTileRefresh = true; // set to true so the tile-drawing event fires
|
||||
viewer.open( '/test/data/testpattern.dzi' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Viewer: tile-drawing event', function (assert) {
|
||||
var done = assert.async();
|
||||
var previousValue = viewer.drawer.continuousTileRefresh;
|
||||
if(viewer.drawer.getType() !== 'canvas'){
|
||||
assert.expect(0);
|
||||
done();
|
||||
return;
|
||||
}
|
||||
// var previousValue = viewer.drawer.continuousTileRefresh;
|
||||
|
||||
var tileDrawing = function ( event ) {
|
||||
viewer.removeHandler( 'tile-drawing', tileDrawing );
|
||||
@ -1202,12 +1212,12 @@
|
||||
assert.ok(event.tile, "Tile should be set");
|
||||
assert.ok(event.rendered, "Rendered should be set");
|
||||
}
|
||||
viewer.drawer.continuousTileRefresh = previousValue; // reset property
|
||||
// viewer.drawer.continuousTileRefresh = previousValue; // reset property
|
||||
viewer.close();
|
||||
done();
|
||||
};
|
||||
|
||||
viewer.drawer.continuousTileRefresh = true; // set to true so the tile-drawing event fires
|
||||
// viewer.drawer.continuousTileRefresh = true; // set to true so the tile-drawing event fires
|
||||
viewer.addHandler( 'tile-drawing', tileDrawing );
|
||||
viewer.open( '/test/data/testpattern.dzi' );
|
||||
} );
|
||||
|
@ -262,12 +262,12 @@
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
// trigger a redraw so the event fires
|
||||
firstImage.redraw();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user