More tests and docs for extent and coordinate wrapX

This commit is contained in:
Andreas Hocevar
2020-03-31 15:52:29 +02:00
parent cdafc4fa05
commit 9af1e223af
2 changed files with 8 additions and 1 deletions

View File

@@ -407,7 +407,8 @@ export function toStringXY(coordinate, opt_fractionDigits) {
/**
* Modifies the provided coordinate in-place to be within the real world
* extent.
* extent. The lower projection extent boundary is inclusive, the upper one
* exclusive.
*
* @param {Coordinate} coordinate Coordinate.
* @param {import("./proj/Projection.js").default} projection Projection

View File

@@ -849,6 +849,12 @@ describe('ol.extent', function() {
expect(_ol_extent_.wrapX([300, 48, 376, 49], projection)).to.eql([-60, 48, 16, 49]);
});
it('produces the same real world extent for shifted extents with center at +/-180', function() {
expect(_ol_extent_.wrapX([360, -90, 720, 90], projection)).to.eql([-360, -90, 0, 90]);
expect(_ol_extent_.wrapX([0, -90, 360, 90], projection)).to.eql([-360, -90, 0, 90]);
expect(_ol_extent_.wrapX([-360, -90, 0, 90], projection)).to.eql([-360, -90, 0, 90]);
});
});
describe('approximatelyEquals', function() {