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:
@@ -73,6 +73,22 @@ describe('ol.geom.LineString', function() {
|
||||
expect(lineString.getStride()).to.be(2);
|
||||
});
|
||||
|
||||
describe('#intersectsExtent', function() {
|
||||
|
||||
it('return false for non matching extent', function() {
|
||||
expect(lineString.intersectsExtent([1, 3, 1.9, 4])).to.be(false);
|
||||
});
|
||||
|
||||
it('return true for extent on midpoint', function() {
|
||||
expect(lineString.intersectsExtent([2, 3, 4, 3])).to.be(true);
|
||||
});
|
||||
|
||||
it('returns true for the geom\'s own extent', function() {
|
||||
expect(lineString.intersectsExtent(lineString.getExtent())).to.be(true);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('construct with 3D coordinates', function() {
|
||||
@@ -102,6 +118,22 @@ describe('ol.geom.LineString', function() {
|
||||
expect(lineString.getStride()).to.be(3);
|
||||
});
|
||||
|
||||
describe('#intersectsExtent', function() {
|
||||
|
||||
it('return false for non matching extent', function() {
|
||||
expect(lineString.intersectsExtent([1, 3, 1.9, 4])).to.be(false);
|
||||
});
|
||||
|
||||
it('return true for extent on midpoint', function() {
|
||||
expect(lineString.intersectsExtent([2, 3, 4, 3])).to.be(true);
|
||||
});
|
||||
|
||||
it('returns true for the geom\'s own extent', function() {
|
||||
expect(lineString.intersectsExtent(lineString.getExtent())).to.be(true);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('construct with 3D coordinates and layout XYM', function() {
|
||||
@@ -132,6 +164,22 @@ describe('ol.geom.LineString', function() {
|
||||
expect(lineString.getStride()).to.be(3);
|
||||
});
|
||||
|
||||
describe('#intersectsExtent', function() {
|
||||
|
||||
it('return false for non matching extent', function() {
|
||||
expect(lineString.intersectsExtent([1, 3, 1.9, 4])).to.be(false);
|
||||
});
|
||||
|
||||
it('return true for extent on midpoint', function() {
|
||||
expect(lineString.intersectsExtent([2, 3, 4, 3])).to.be(true);
|
||||
});
|
||||
|
||||
it('returns true for the geom\'s own extent', function() {
|
||||
expect(lineString.intersectsExtent(lineString.getExtent())).to.be(true);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('construct with 4D coordinates', function() {
|
||||
@@ -161,6 +209,22 @@ describe('ol.geom.LineString', function() {
|
||||
expect(lineString.getStride()).to.be(4);
|
||||
});
|
||||
|
||||
describe('#intersectsExtent', function() {
|
||||
|
||||
it('return false for non matching extent', function() {
|
||||
expect(lineString.intersectsExtent([1, 3, 1.9, 4])).to.be(false);
|
||||
});
|
||||
|
||||
it('return true for extent on midpoint', function() {
|
||||
expect(lineString.intersectsExtent([2, 3, 4, 3])).to.be(true);
|
||||
});
|
||||
|
||||
it('returns true for the geom\'s own extent', function() {
|
||||
expect(lineString.intersectsExtent(lineString.getExtent())).to.be(true);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('with a simple line string', function() {
|
||||
|
||||
Reference in New Issue
Block a user