Ignore user provided tile cache size when too small
This commit is contained in:
@@ -63,13 +63,19 @@ describe('ol.source.Tile', function() {
|
||||
const source = new TileSource({});
|
||||
expect(source.tileCache.highWaterMark).to.be(4 * Math.ceil(screen.availWidth / 256) * Math.ceil(screen.availHeight / 256));
|
||||
});
|
||||
it('ignores a cache size that is too small', function() {
|
||||
const source = new TileSource({
|
||||
cacheSize: 1
|
||||
});
|
||||
expect(source.tileCache.highWaterMark).to.be(4 * Math.ceil(screen.availWidth / 256) * Math.ceil(screen.availHeight / 256));
|
||||
});
|
||||
it('sets a custom cache size', function() {
|
||||
const projection = getProjection('EPSG:4326');
|
||||
const source = new TileSource({
|
||||
projection: projection,
|
||||
cacheSize: 42
|
||||
cacheSize: 442
|
||||
});
|
||||
expect(source.getTileCacheForProjection(projection).highWaterMark).to.be(42);
|
||||
expect(source.getTileCacheForProjection(projection).highWaterMark).to.be(442);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -26,9 +26,9 @@ describe('ol.source.TileImage', function() {
|
||||
|
||||
describe('#getTileCacheForProjection', function() {
|
||||
it('uses the cacheSize for reprojected tile caches', function() {
|
||||
const source = createSource(undefined, undefined, 42);
|
||||
const source = createSource(undefined, undefined, 442);
|
||||
const tileCache = source.getTileCacheForProjection(getProjection('EPSG:4326'));
|
||||
expect(tileCache.highWaterMark).to.be(42);
|
||||
expect(tileCache.highWaterMark).to.be(442);
|
||||
expect(tileCache).to.not.equal(source.getTileCacheForProjection(source.getProjection()));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user