Add additional tests
This commit is contained in:
@@ -322,6 +322,66 @@ describe('ol.tilegrid.TileGrid', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('create with complex configuration', function () {
|
||||||
|
let tileGrid;
|
||||||
|
beforeEach(function () {
|
||||||
|
tileGrid = new TileGrid({
|
||||||
|
extent: [
|
||||||
|
343870.8496458133,
|
||||||
|
5809157.009546259,
|
||||||
|
1905238.0275122682,
|
||||||
|
7515502.7821859205,
|
||||||
|
],
|
||||||
|
sizes: [
|
||||||
|
[1, 2],
|
||||||
|
[2, 4],
|
||||||
|
[2, 4],
|
||||||
|
[11, 16],
|
||||||
|
],
|
||||||
|
resolutions: [
|
||||||
|
4174.778550445067,
|
||||||
|
2087.3892752225333,
|
||||||
|
1043.6946376112667,
|
||||||
|
521.8473188056333,
|
||||||
|
],
|
||||||
|
tileSizes: [
|
||||||
|
[374, 204],
|
||||||
|
[374, 204],
|
||||||
|
[748, 409],
|
||||||
|
[272, 204],
|
||||||
|
],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('creates correct tile ranges', function () {
|
||||||
|
const tileRanges = [
|
||||||
|
{minX: 0, maxX: 0, minY: 0, maxY: 1},
|
||||||
|
{minX: 0, maxX: 1, minY: 0, maxY: 3},
|
||||||
|
{minX: 0, maxX: 1, minY: 0, maxY: 3},
|
||||||
|
{minX: 0, maxX: 10, minY: 0, maxY: 15},
|
||||||
|
];
|
||||||
|
for (let z = 0; z <= 3; ++z) {
|
||||||
|
const zTileRange = tileGrid.getFullTileRange(z);
|
||||||
|
for (const property in tileRanges[z]) {
|
||||||
|
expect(zTileRange[property]).to.be(tileRanges[z][property]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns correct withinExtentAndZ results with containsXY', function () {
|
||||||
|
const outOfRangeTileCoords = [
|
||||||
|
[1, 2, 0],
|
||||||
|
[1, 2, 1],
|
||||||
|
[1, 2, 2],
|
||||||
|
[1, 2, 3],
|
||||||
|
];
|
||||||
|
outOfRangeTileCoords.forEach(function (tileCoord) {
|
||||||
|
const tileRange = tileGrid.getFullTileRange(tileCoord[0]);
|
||||||
|
expect(tileRange.containsXY(tileCoord[1], tileCoord[2])).to.be(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('createForExtent', function () {
|
describe('createForExtent', function () {
|
||||||
it('allows creation of tile grid from extent', function () {
|
it('allows creation of tile grid from extent', function () {
|
||||||
const extent = createOrUpdate(-100, -100, 100, 100);
|
const extent = createOrUpdate(-100, -100, 100, 100);
|
||||||
|
|||||||
Reference in New Issue
Block a user