Add tests
This commit is contained in:
@@ -2,6 +2,8 @@ import Map from '../../../../../src/ol/Map.js';
|
|||||||
import View from '../../../../../src/ol/View.js';
|
import View from '../../../../../src/ol/View.js';
|
||||||
import TileLayer from '../../../../../src/ol/layer/Tile.js';
|
import TileLayer from '../../../../../src/ol/layer/Tile.js';
|
||||||
import TileWMS from '../../../../../src/ol/source/TileWMS.js';
|
import TileWMS from '../../../../../src/ol/source/TileWMS.js';
|
||||||
|
import XYZ from '../../../../../src/ol/source/XYZ.js';
|
||||||
|
import {fromLonLat} from '../../../../../src/ol/proj.js';
|
||||||
|
|
||||||
|
|
||||||
describe('ol.renderer.canvas.TileLayer', function() {
|
describe('ol.renderer.canvas.TileLayer', function() {
|
||||||
@@ -49,4 +51,36 @@ describe('ol.renderer.canvas.TileLayer', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('#renderFrame', function() {
|
||||||
|
let map, layer;
|
||||||
|
beforeEach(function() {
|
||||||
|
layer = new TileLayer({
|
||||||
|
source: new XYZ({
|
||||||
|
cacheSize: 1,
|
||||||
|
url: 'rendering/ol/data/tiles/osm/{z}/{x}/{y}.png'
|
||||||
|
})
|
||||||
|
});
|
||||||
|
map = new Map({
|
||||||
|
target: createMapDiv(100, 100),
|
||||||
|
layers: [layer],
|
||||||
|
view: new View({
|
||||||
|
center: fromLonLat([-122.416667, 37.783333]),
|
||||||
|
zoom: 5
|
||||||
|
})
|
||||||
|
});
|
||||||
|
});
|
||||||
|
afterEach(function() {
|
||||||
|
disposeMap(map);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('increases the cache size if necessary', function(done) {
|
||||||
|
const tileCache = layer.getSource().tileCache;
|
||||||
|
expect(tileCache.highWaterMark).to.be(1);
|
||||||
|
map.once('rendercomplete', function() {
|
||||||
|
expect(tileCache.highWaterMark).to.be(2);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user