Make ol.geom.Circle support #intersectsExtent, with tests

This commit is contained in:
Alvin Lindstam
2015-06-05 10:47:54 +02:00
parent 405d5666e2
commit 1dc6c99328
2 changed files with 47 additions and 0 deletions

View File

@@ -203,6 +203,30 @@ describe('ol.geom.Circle', function() {
});
describe('#intersectsExtent', function() {
it('return false for non matching extent', function() {
expect(circle.intersectsExtent([0.9, 0.9, 10, 10])).to.be(false);
});
it('return true for extent within circle', function() {
expect(circle.intersectsExtent([0.5, 0.5, 0.5, 0.5])).to.be(true);
});
it('return true for extent overlapping circle', function() {
expect(circle.intersectsExtent([0.5, 0.5, 10, 10])).to.be(true);
});
it('return true for non-overlapping but intersecting extent', function() {
expect(circle.intersectsExtent([0, 1, 1, 2])).to.be(true);
});
it('returns true for the geom\'s own extent', function() {
expect(circle.intersectsExtent(circle.getExtent())).to.be(true);
});
});
});
});