Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
MINOR: Relates to #2019, fix broken storageLevelOffset (#2047)
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan Stichbury <[email protected]>
  • Loading branch information
nzjony authored Jan 14, 2021
1 parent b436523 commit 832f016
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions @here/harp-webtile-datasource/lib/HereWebTileDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,10 @@ export class HereWebTileDataSource extends WebTileDataSource {
minDataLevel: 1,
maxDataLevel: 20,
resolution: m_options.resolution,
dataProvider: new HereTileProvider(m_options)
dataProvider: new HereTileProvider(m_options),
storageLevelOffset: m_options.storageLevelOffset ?? -1
});
this.cacheable = true;
this.storageLevelOffset = -1;
if (this.resolution === WebTileDataSource.resolutionValue.resolution512) {
this.maxDataLevel = 19; // 512x512 tiles do not have z19
}
Expand Down
19 changes: 19 additions & 0 deletions @here/harp-webtile-datasource/test/HereWebTileDataSourceTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,23 @@ describe("HereWebTileDataSource", function() {
it("#createWebTileDataSource throws w/ missing appId", async function() {
assert.throw(() => new HereWebTileDataSource({ appCode: "42" } as any));
});
it("#createWebTileDataSource check storageLevelOffset", async function() {
const apikey = "123";
for (let storageLevelOffset = -2; storageLevelOffset <= 2; storageLevelOffset++) {
const webTileDataSource = new HereWebTileDataSource({
apikey,
tileBaseAddress: HereTileProvider.TILE_AERIAL_SATELLITE,
storageLevelOffset
});
assert(webTileDataSource.storageLevelOffset === storageLevelOffset);
}

// Test the default value
const webTileDataSource = new HereWebTileDataSource({
apikey,
tileBaseAddress: HereTileProvider.TILE_AERIAL_SATELLITE,
storageLevelOffset: undefined
});
assert(webTileDataSource.storageLevelOffset === -1);
});
});

0 comments on commit 832f016

Please sign in to comment.