Fix getIntersection return value when an opt extent is provided

The return value was not an empty extent when the extents didn't intersect.
This commit is contained in:
Frederic Junod
2018-02-07 14:22:07 +01:00
parent e8c3556183
commit 76cd52325d

View File

@@ -291,6 +291,20 @@ describe('ol.extent', function() {
expect(_ol_extent_.getIntersection(north, west)).to.eql([-180, 0, 0, 90]);
expect(_ol_extent_.getIntersection(east, south)).to.eql([0, -90, 180, 0]);
});
it('can take an destination extent', function() {
const world = [-180, -90, 180, 90];
const north = [-180, 0, 180, 90];
const none = _ol_extent_.createEmpty();
let tmpExtent = [-180, 45, 180, 90];
expect(_ol_extent_.getIntersection(world, north, tmpExtent)).to.eql(north);
expect(_ol_extent_.getIntersection(world, none, tmpExtent)).to.eql(none);
tmpExtent = [-180, -90, 180, 90];
expect(_ol_extent_.getIntersection(tmpExtent, north, tmpExtent)).to.eql(north);
});
});
describe('containsCoordinate', function() {