Add tests for intersectsExtent/getExtent

This commit adds tests for `intersectsExtent` of Point, LineString, Polygon,
MultiPoint, MultiLineString, MultiPolygon and GeometryCollection.

It also adds a basic test for `getExtent` of MultiPolygon
This commit is contained in:
Alvin Lindstam
2015-06-05 09:57:36 +02:00
parent bad5a97d20
commit 405d5666e2
7 changed files with 249 additions and 0 deletions

View File

@@ -37,6 +37,14 @@ describe('ol.geom.Point', function() {
expect(point.getStride()).to.be(2);
});
it('does not intersect non matching extent', function() {
expect(point.intersectsExtent([0, 0, 10, 0.5])).to.be(false);
});
it('does intersect it\'s extent', function() {
expect(point.intersectsExtent(point.getExtent())).to.be(true);
});
});
describe('construct with 3D coordinates and layout XYM', function() {
@@ -66,6 +74,14 @@ describe('ol.geom.Point', function() {
expect(point.getStride()).to.be(3);
});
it('does not intersect non matching extent', function() {
expect(point.intersectsExtent([0, 0, 10, 0.5])).to.be(false);
});
it('does intersect it\'s extent', function() {
expect(point.intersectsExtent(point.getExtent())).to.be(true);
});
});
describe('construct with 4D coordinates', function() {
@@ -95,6 +111,14 @@ describe('ol.geom.Point', function() {
expect(point.getStride()).to.be(4);
});
it('does not intersect non matching extent', function() {
expect(point.intersectsExtent([0, 0, 10, 0.5])).to.be(false);
});
it('does intersect it\'s extent', function() {
expect(point.intersectsExtent(point.getExtent())).to.be(true);
});
describe('#getClosestPoint', function() {
it('preseves extra dimensions', function() {