Configure cache on the layer instead of the source

This commit is contained in:
Tim Schaub
2021-08-27 17:33:04 -06:00
parent 3b6bf14cdc
commit d37e3e3134
5 changed files with 48 additions and 21 deletions
+12 -1
View File
@@ -5,7 +5,7 @@ import WebGLHelper from '../../../../../src/ol/webgl/Helper.js';
import WebGLTileLayer from '../../../../../src/ol/layer/WebGLTile.js';
import {createCanvasContext2D} from '../../../../../src/ol/dom.js';
describe('ol.layer.Tile', function () {
describe('ol/layer/WebGLTile', function () {
/** @type {WebGLTileLayer} */
let layer;
/** @type {Map} */
@@ -120,6 +120,17 @@ describe('ol.layer.Tile', function () {
});
});
it('tries to expire the source tile cache', (done) => {
const source = layer.getSource();
const expire = sinon.spy(source, 'expireCache');
layer.updateStyleVariables({r: 1, g: 2, b: 3});
map.once('rendercomplete', () => {
expect(expire.called).to.be(true);
done();
});
});
it('throws on incorrect style configs', function () {
function incorrectStyle() {
layer.style_ = {