Deprecate the imageSmoothing option for sources

This commit is contained in:
Tim Schaub
2021-12-27 12:25:11 -07:00
parent 8d8632bff7
commit e2883fb658
48 changed files with 538 additions and 191 deletions

View File

@@ -1,7 +1,7 @@
import BingMaps, {quadKey} from '../../../../../src/ol/source/BingMaps.js';
import {unByKey} from '../../../../../src/ol/Observable.js';
describe('ol.source.BingMaps', function () {
describe('ol/source/BingMaps', function () {
describe('quadKey()', function () {
it('returns expected string', function () {
const tileCoord = [3, 3, 5];
@@ -10,6 +10,23 @@ describe('ol.source.BingMaps', function () {
});
});
describe('#getInterpolate()', function () {
it('is true by default', function () {
const source = new BingMaps({});
expect(source.getInterpolate()).to.be(true);
});
it('is false if constructed with interpolate: false', function () {
const source = new BingMaps({interpolate: false});
expect(source.getInterpolate()).to.be(false);
});
it('is false if constructed with imageSmoothing: false', function () {
const source = new BingMaps({imageSmoothing: false});
expect(source.getInterpolate()).to.be(false);
});
});
describe('#tileUrlFunction()', function () {
let source, tileGrid;

View File

@@ -2,7 +2,7 @@ import DataTile from '../../../../../src/ol/DataTile.js';
import DataTileSource from '../../../../../src/ol/source/DataTile.js';
import TileState from '../../../../../src/ol/TileState.js';
describe('ol.source.DataTile', function () {
describe('ol/source/DataTile', function () {
/** @type {DataTileSource} */
let source;
beforeEach(function () {
@@ -39,4 +39,16 @@ describe('ol.source.DataTile', function () {
tile.load();
});
});
describe('#getInterpolate()', function () {
it('is false by default', function () {
const source = new DataTileSource({loader: () => {}});
expect(source.getInterpolate()).to.be(false);
});
it('is true if constructed with interpoate: true', function () {
const source = new DataTileSource({interpolate: true, loader: () => {}});
expect(source.getInterpolate()).to.be(true);
});
});
});

View File

@@ -2,7 +2,7 @@ import IIIF from '../../../../../src/ol/source/IIIF.js';
import {DEFAULT_TILE_SIZE} from '../../../../../src/ol/tilegrid/common.js';
import {Versions} from '../../../../../src/ol/format/IIIFInfo.js';
describe('ol.source.IIIF', function () {
describe('ol/source/IIIF', function () {
const width = 2000,
height = 1500,
size = [width, height],
@@ -141,6 +141,23 @@ describe('ol.source.IIIF', function () {
});
});
describe('#getInterpolate()', function () {
it('is true by default', function () {
const source = new IIIF({size: size});
expect(source.getInterpolate()).to.be(true);
});
it('is false if constructed with interpolate: false', function () {
const source = new IIIF({size: size, interpolate: false});
expect(source.getInterpolate()).to.be(false);
});
it('is false if constructed with imageSmoothing: false', function () {
const source = new IIIF({size: size, imageSmoothing: false});
expect(source.getInterpolate()).to.be(false);
});
});
describe('tileUrlFunction', function () {
it('has only one resolution and one tile if no tiles, resolutions, sizes and supported features are given', function () {
let tileUrlFunction = getSource().getTileUrlFunction();

View File

@@ -1,7 +1,7 @@
import ImageArcGISRest from '../../../../../src/ol/source/ImageArcGISRest.js';
import {get as getProjection} from '../../../../../src/ol/proj.js';
describe('ol.source.ImageArcGISRest', function () {
describe('ol/source/ImageArcGISRest', function () {
let pixelRatio, options, projection, proj3857, resolution;
beforeEach(function () {
pixelRatio = 1;
@@ -14,6 +14,27 @@ describe('ol.source.ImageArcGISRest', function () {
};
});
describe('#getInterpolate()', function () {
it('is true by default', function () {
const source = new ImageArcGISRest(options);
expect(source.getInterpolate()).to.be(true);
});
it('is false if constructed with interpolate: false', function () {
const source = new ImageArcGISRest(
Object.assign({interpolate: false}, options)
);
expect(source.getInterpolate()).to.be(false);
});
it('is false if constructed with imageSmoothing: false', function () {
const source = new ImageArcGISRest(
Object.assign({imageSmoothing: false}, options)
);
expect(source.getInterpolate()).to.be(false);
});
});
describe('#getImage', function () {
it('returns a image with the expected URL', function () {
const source = new ImageArcGISRest(options);

View File

@@ -1,7 +1,7 @@
import Static from '../../../../../src/ol/source/ImageStatic.js';
import {get as getProjection} from '../../../../../src/ol/proj.js';
describe('ol.source.ImageStatic', function () {
describe('ol/source/ImageStatic', function () {
let extent, pixelRatio, projection, resolution;
beforeEach(function () {
extent = [
@@ -13,6 +13,23 @@ describe('ol.source.ImageStatic', function () {
resolution = 38;
});
describe('#getInterpolate()', function () {
it('is true by default', function () {
const source = new Static({});
expect(source.getInterpolate()).to.be(true);
});
it('is false if constructed with interpolate: false', function () {
const source = new Static({interpolate: false});
expect(source.getInterpolate()).to.be(false);
});
it('is false if constructed with imageSmoothing: false', function () {
const source = new Static({imageSmoothing: false});
expect(source.getInterpolate()).to.be(false);
});
});
describe('#getImage', function () {
it('scales image height to fit imageExtent', function (done) {
const source = new Static({

View File

@@ -1,7 +1,7 @@
import Source from '../../../../../src/ol/source/Source.js';
import {get as getProjection} from '../../../../../src/ol/proj.js';
describe('ol.source.Source', function () {
describe('ol/source/Source', function () {
describe('constructor', function () {
it('returns a source', function () {
const source = new Source({
@@ -75,6 +75,18 @@ describe('ol.source.Source', function () {
});
});
describe('#getInterpolate()', function () {
it('returns false by default', function () {
const source = new Source({});
expect(source.getInterpolate()).to.be(false);
});
it('returns true if constructed with interpolate: true', function () {
const source = new Source({interpolate: true});
expect(source.getInterpolate()).to.be(true);
});
});
describe('#setAttributions()', function () {
let source = null;

View File

@@ -48,7 +48,7 @@ MockTile.prototype.getTile = function (z, x, y) {
}
};
describe('ol.source.Tile', function () {
describe('ol/source/Tile', function () {
describe('constructor', function () {
it('returns a tile source', function () {
const source = new TileSource({
@@ -109,6 +109,18 @@ describe('ol.source.Tile', function () {
});
});
describe('#getInterpolate()', function () {
it('is false by default', function () {
const source = new TileSource({});
expect(source.getInterpolate()).to.be(false);
});
it('is true if constructed with interpolate: true', function () {
const source = new TileSource({interpolate: true});
expect(source.getInterpolate()).to.be(true);
});
});
describe('#setKey()', function () {
it('dispatches a change event', function (done) {
const source = new TileSource({});

View File

@@ -18,7 +18,7 @@ import {getKeyZXY} from '../../../../../src/ol/tilecoord.js';
import {listen} from '../../../../../src/ol/events.js';
import {register} from '../../../../../src/ol/proj/proj4.js';
describe('ol.source.TileImage', function () {
describe('ol/source/TileImage', function () {
function createSource(opt_proj, opt_tileGrid, opt_cacheSize) {
const proj = opt_proj || 'EPSG:3857';
return new TileImage({
@@ -31,6 +31,23 @@ describe('ol.source.TileImage', function () {
});
}
describe('#getInterpolate()', function () {
it('is true by default', function () {
const source = new TileImage({});
expect(source.getInterpolate()).to.be(true);
});
it('is false if constructed with interpolate: false', function () {
const source = new TileImage({interpolate: false});
expect(source.getInterpolate()).to.be(false);
});
it('is false if constructed with imageSmoothing: false', function () {
const source = new TileImage({imageSmoothing: false});
expect(source.getInterpolate()).to.be(false);
});
});
describe('#getTileCacheForProjection', function () {
it('uses the cacheSize for reprojected tile caches', function () {
const source = createSource(undefined, undefined, 442);

View File

@@ -3,7 +3,7 @@ import TileJSON from '../../../../../src/ol/source/TileJSON.js';
import {transformExtent} from '../../../../../src/ol/proj.js';
import {unByKey} from '../../../../../src/ol/Observable.js';
describe('ol.source.TileJSON', function () {
describe('ol/source/TileJSON', function () {
describe('constructor', function () {
it('returns a tileJSON source', function () {
const source = new TileJSON({
@@ -14,6 +14,29 @@ describe('ol.source.TileJSON', function () {
});
});
describe('#getInterpolate()', function () {
it('is true by default', function () {
const source = new TileJSON({url: 'spec/ol/data/tilejson.json'});
expect(source.getInterpolate()).to.be(true);
});
it('is false if constructed with interpolate: false', function () {
const source = new TileJSON({
interpolate: false,
url: 'spec/ol/data/tilejson.json',
});
expect(source.getInterpolate()).to.be(false);
});
it('is false if constructed with imageSmoothing: false', function () {
const source = new TileJSON({
imageSmoothing: false,
url: 'spec/ol/data/tilejson.json',
});
expect(source.getInterpolate()).to.be(false);
});
});
describe('#getTileJSON', function () {
it('parses the tilejson file', function () {
const source = new TileJSON({

View File

@@ -4,7 +4,7 @@ import TileWMS from '../../../../../src/ol/source/TileWMS.js';
import {createXYZ} from '../../../../../src/ol/tilegrid.js';
import {get as getProjection} from '../../../../../src/ol/proj.js';
describe('ol.source.TileWMS', function () {
describe('ol/source/TileWMS', function () {
let options, optionsReproj;
beforeEach(function () {
options = {
@@ -32,6 +32,23 @@ describe('ol.source.TileWMS', function () {
});
});
describe('#getInterpolate()', function () {
it('is true by default', function () {
const source = new TileWMS();
expect(source.getInterpolate()).to.be(true);
});
it('is false if constructed with interpolate: false', function () {
const source = new TileWMS({interpolate: false});
expect(source.getInterpolate()).to.be(false);
});
it('is false if constructed with imageSmoothing: false', function () {
const source = new TileWMS({imageSmoothing: false});
expect(source.getInterpolate()).to.be(false);
});
});
describe('#getTile', function () {
it('returns a tile with the expected URL', function () {
const source = new TileWMS(options);

View File

@@ -2,7 +2,7 @@ import UrlTile from '../../../../../src/ol/source/UrlTile.js';
import {createXYZ} from '../../../../../src/ol/tilegrid.js';
import {get as getProjection} from '../../../../../src/ol/proj.js';
describe('ol.source.UrlTile', function () {
describe('ol/source/UrlTile', function () {
describe('#setUrl()', function () {
it('sets the URL for the source', function () {
const source = new UrlTile({});
@@ -23,6 +23,18 @@ describe('ol.source.UrlTile', function () {
});
});
describe('#getInterpolate()', function () {
it('is false by default', function () {
const source = new UrlTile({});
expect(source.getInterpolate()).to.be(false);
});
it('is true if constructed with interpolate: true', function () {
const source = new UrlTile({interpolate: true});
expect(source.getInterpolate()).to.be(true);
});
});
describe('#setUrls()', function () {
it('sets the URL for the source', function () {
const source = new UrlTile({});

View File

@@ -7,7 +7,7 @@ import WMTSTileGrid from '../../../../../src/ol/tilegrid/WMTS.js';
import {getBottomLeft, getTopRight} from '../../../../../src/ol/extent.js';
import {get as getProjection} from '../../../../../src/ol/proj.js';
describe('ol.source.WMTS', function () {
describe('ol/source/WMTS', function () {
describe('when creating options from capabilities', function () {
const parser = new WMTSCapabilities();
let capabilities, content;
@@ -230,6 +230,23 @@ describe('ol.source.WMTS', function () {
});
});
describe('#getInterpolate()', function () {
it('is true by default', function () {
const source = new WMTS({});
expect(source.getInterpolate()).to.be(true);
});
it('is false if constructed with interpolate: false', function () {
const source = new WMTS({interpolate: false});
expect(source.getInterpolate()).to.be(false);
});
it('is false if constructed with imageSmoothing: false', function () {
const source = new WMTS({imageSmoothing: false});
expect(source.getInterpolate()).to.be(false);
});
});
describe('when creating tileUrlFunction', function () {
const defaultTileGrid = new WMTSTileGrid({
origin: [-20037508.342789244, 20037508.342789244],

View File

@@ -7,7 +7,7 @@ import View from '../../../../../src/ol/View.js';
import XYZ from '../../../../../src/ol/source/XYZ.js';
import {createXYZ} from '../../../../../src/ol/tilegrid.js';
describe('ol.source.XYZ', function () {
describe('ol/source/XYZ', function () {
describe('constructor', function () {
it('can be constructed without options', function () {
const source = new XYZ();
@@ -47,6 +47,23 @@ describe('ol.source.XYZ', function () {
});
});
describe('getInterpolate()', function () {
it('is true by default', function () {
const source = new XYZ();
expect(source.getInterpolate()).to.be(true);
});
it('is false if constructed with interpolate: false', function () {
const source = new XYZ({interpolate: false});
expect(source.getInterpolate()).to.be(false);
});
it('is false if constructed with imageSmoothing: false', function () {
const source = new XYZ({imageSmoothing: false});
expect(source.getInterpolate()).to.be(false);
});
});
describe('tileUrlFunction', function () {
let xyzTileSource, tileGrid;

View File

@@ -4,7 +4,7 @@ import Zoomify, {CustomTile} from '../../../../../src/ol/source/Zoomify.js';
import {DEFAULT_TILE_SIZE} from '../../../../../src/ol/tilegrid/common.js';
import {listen} from '../../../../../src/ol/events.js';
describe('ol.source.Zoomify', function () {
describe('ol/source/Zoomify', function () {
const w = 1024;
const h = 512;
const size = [w, h];
@@ -141,6 +141,27 @@ describe('ol.source.Zoomify', function () {
});
});
describe('#getInterpolate()', function () {
it('is true by default', function () {
const source = new Zoomify({url: '', size: [47, 11]});
expect(source.getInterpolate()).to.be(true);
});
it('is false if constructed with interpolate: false', function () {
const source = new Zoomify({interpolate: false, url: '', size: [47, 11]});
expect(source.getInterpolate()).to.be(false);
});
it('is false if constructed with imageSmoothing: false', function () {
const source = new Zoomify({
imageSmoothing: false,
url: '',
size: [47, 11],
});
expect(source.getInterpolate()).to.be(false);
});
});
describe('generated tileGrid', function () {
it('has expected extent', function () {
const sources = [getZoomifySource(), getIIPSource()];