mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-01-31 15:12:07 +03:00
Fix test for the preload hack (and fix the parentheses to always call updateMulti).
This commit is contained in:
parent
a690b50eee
commit
cf2413e0c9
@ -356,7 +356,7 @@ $.Viewer = function( options ) {
|
|||||||
|
|
||||||
//if we are not throttling
|
//if we are not throttling
|
||||||
if (_this.imageLoader.canAcceptNewJob()) {
|
if (_this.imageLoader.canAcceptNewJob()) {
|
||||||
//todo small hack, we could make this builtin speedup more sophisticated
|
//todo small hack, we could make this builtin speedup more sophisticated, breaks tests --> commented out
|
||||||
const item = event.item;
|
const item = event.item;
|
||||||
const origOpacity = item.opacity;
|
const origOpacity = item.opacity;
|
||||||
const origMaxTiles = item.maxTilesPerFrame;
|
const origMaxTiles = item.maxTilesPerFrame;
|
||||||
@ -367,11 +367,11 @@ $.Viewer = function( options ) {
|
|||||||
item._needsDraw = true; //we did not draw
|
item._needsDraw = true; //we did not draw
|
||||||
item.opacity = origOpacity;
|
item.opacity = origOpacity;
|
||||||
item.maxTilesPerFrame = origMaxTiles;
|
item.maxTilesPerFrame = origMaxTiles;
|
||||||
|
}
|
||||||
|
|
||||||
if (!_this._updateRequestId) {
|
if (!_this._updateRequestId) {
|
||||||
_this._updateRequestId = scheduleUpdate( _this, updateMulti );
|
_this._updateRequestId = scheduleUpdate( _this, updateMulti );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.world.addHandler('remove-item', function(event) {
|
this.world.addHandler('remove-item', function(event) {
|
||||||
|
@ -1288,22 +1288,25 @@
|
|||||||
|
|
||||||
QUnit.test( 'Viewer: tile-unloaded event.', function(assert) {
|
QUnit.test( 'Viewer: tile-unloaded event.', function(assert) {
|
||||||
var tiledImage;
|
var tiledImage;
|
||||||
var tile;
|
var tiles = [];
|
||||||
var done = assert.async();
|
var done = assert.async();
|
||||||
|
|
||||||
function tileLoaded( event ) {
|
function tileLoaded( event ) {
|
||||||
viewer.removeHandler( 'tile-loaded', tileLoaded);
|
|
||||||
tiledImage = event.tiledImage;
|
tiledImage = event.tiledImage;
|
||||||
tile = event.tile;
|
tiles.push(event.tile);
|
||||||
|
if (tiles.length === 1) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
tiledImage.reset();
|
tiledImage.reset();
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function tileUnloaded( event ) {
|
function tileUnloaded( event ) {
|
||||||
|
viewer.removeHandler( 'tile-loaded', tileLoaded);
|
||||||
viewer.removeHandler( 'tile-unloaded', tileUnloaded );
|
viewer.removeHandler( 'tile-unloaded', tileUnloaded );
|
||||||
assert.equal( tile, event.tile,
|
|
||||||
"The unloaded tile should be the same than the loaded one." );
|
assert.equal( tiles.find(t => t === event.tile), event.tile,
|
||||||
|
"The unloaded tile should be one of the loaded tiles." );
|
||||||
assert.equal( tiledImage, event.tiledImage,
|
assert.equal( tiledImage, event.tiledImage,
|
||||||
"The tiledImage of the unloaded tile should be the same than the one of the loaded one." );
|
"The tiledImage of the unloaded tile should be the same than the one of the loaded one." );
|
||||||
done();
|
done();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user