Add support for auto conversion to RGB

This commit is contained in:
Tim Schaub
2022-08-28 11:38:35 -05:00
parent c742fe965f
commit bd3b1bb434
6 changed files with 98 additions and 10 deletions

View File

@@ -3,7 +3,7 @@ import TileState from '../../../../../src/ol/TileState.js';
describe('ol/source/GeoTIFF', function () {
describe('constructor', function () {
it('configures readMethod_ to read rasters', function () {
it('sets convertToRGB false by default', function () {
const source = new GeoTIFFSource({
sources: [
{
@@ -11,10 +11,10 @@ describe('ol/source/GeoTIFF', function () {
},
],
});
expect(source.readMethod_).to.be('readRasters');
expect(source.convertToRGB_).to.be(false);
});
it('configures readMethod_ to read RGB', function () {
it('respects the convertToRGB option', function () {
const source = new GeoTIFFSource({
convertToRGB: true,
sources: [
@@ -23,7 +23,19 @@ describe('ol/source/GeoTIFF', function () {
},
],
});
expect(source.readMethod_).to.be('readRGB');
expect(source.convertToRGB_).to.be(true);
});
it('accepts auto convertToRGB', function () {
const source = new GeoTIFFSource({
convertToRGB: 'auto',
sources: [
{
url: 'spec/ol/source/images/0-0-0.tif',
},
],
});
expect(source.convertToRGB_).to.be('auto');
});
it('defaults to wrapX: false', function () {