Fix ol.source.Zoomify tests on firefox
This commit is contained in:
@@ -209,21 +209,26 @@ describe('ol.source.Zoomify', function() {
|
|||||||
expect(img).to.be(img2);
|
expect(img).to.be(img2);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('"tile.getImage" returns and caches a loaded canvas', function() {
|
it('"tile.getImage" returns and caches a loaded canvas', function(done) {
|
||||||
// It'll only cache if the same context is passed, see below
|
// It'll only cache if the same context is passed, see below
|
||||||
var context = ol.dom.createCanvasContext2D(256, 256);
|
var context = ol.dom.createCanvasContext2D(256, 256);
|
||||||
var source = getZoomifySource();
|
var source = getZoomifySource();
|
||||||
|
|
||||||
var tile = source.getTile(0, 0, -1, 1, proj);
|
var tile = source.getTile(0, 0, -1, 1, proj);
|
||||||
tile.state = ol.TileState.LOADED;
|
|
||||||
var img = tile.getImage(context);
|
|
||||||
|
|
||||||
var tile2 = source.getTile(0, 0, -1, 1, proj);
|
ol.events.listen(tile, 'change', function() {
|
||||||
tile2.state = ol.TileState.LOADED;
|
if (tile.getState() == ol.TileState.LOADED) {
|
||||||
var img2 = tile2.getImage(context);
|
var img = tile.getImage(context);
|
||||||
|
expect(img).to.be.a(HTMLCanvasElement);
|
||||||
|
|
||||||
expect(img).to.be.a(HTMLCanvasElement);
|
var tile2 = source.getTile(0, 0, -1, 1, proj);
|
||||||
expect(img).to.be(img2);
|
expect(tile2.getState()).to.be(ol.TileState.LOADED);
|
||||||
|
var img2 = tile2.getImage(context);
|
||||||
|
expect(img).to.be(img2);
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tile.load();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('"tile.getImage" returns and caches an image only for same context', function() {
|
it('"tile.getImage" returns and caches an image only for same context', function() {
|
||||||
@@ -254,6 +259,7 @@ describe('ol.source.Zoomify', function() {
|
|||||||
|
|
||||||
|
|
||||||
goog.require('ol.dom');
|
goog.require('ol.dom');
|
||||||
|
goog.require('ol.events');
|
||||||
goog.require('ol.proj.Projection');
|
goog.require('ol.proj.Projection');
|
||||||
goog.require('ol.source.Zoomify');
|
goog.require('ol.source.Zoomify');
|
||||||
goog.require('ol.TileState');
|
goog.require('ol.TileState');
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
Reference in New Issue
Block a user