Adding extent filter tests

This commit is contained in:
ahocevar
2013-02-15 23:43:10 +01:00
parent 77b8688eae
commit d2a22016e2

View File

@@ -0,0 +1,37 @@
goog.provide('ol.test.filter.Extent');
describe('ol.filter.Extent', function() {
var extent, filter;
beforeEach(function() {
extent = new ol.Extent(0, 0, 45, 90);
filter = new ol.filter.Extent(extent);
});
describe('#getExtent()', function() {
it('returns the configured extent', function() {
expect(filter.getExtent()).toBe(extent);
});
});
describe('#evaluate()', function() {
it('returns true if a feature intersects, false if not', function() {
expect(filter.evaluate(new ol.Feature(new ol.geom.Point([44, 89]))))
.toBe(true);
expect(filter.evaluate(new ol.Feature(new ol.geom.Point([46, 91]))))
.toBe(false);
});
});
});
goog.require('ol.Extent');
goog.require('ol.Feature');
goog.require('ol.filter.Extent');
goog.require('ol.geom.Point');