forEachFeatureAtPixel shouldn't fail if layer has no source

This commit is contained in:
Pierre GIRAUD
2015-09-16 10:18:31 +02:00
parent e88f06b70f
commit badf14e0f1
2 changed files with 16 additions and 4 deletions

View File

@@ -58,12 +58,21 @@ describe('ol.renderer.canvas.Map', function() {
it('filters managed layers', function() {
map.addLayer(layer);
map.renderSync();
cb = sinon.spy();
var cb = sinon.spy();
map.forEachFeatureAtPixel(map.getPixelFromCoordinate([0, 0]), cb, null,
function() { return false; });
expect(cb).to.not.be.called();
});
it('doesn\'t fail with layer with no source', function() {
map.addLayer(new ol.layer.Tile());
map.renderSync();
expect(function() {
map.forEachFeatureAtPixel(map.getPixelFromCoordinate([0, 0]),
function() {});
}).to.not.throwException();
});
});
describe('#renderFrame()', function() {
@@ -92,6 +101,7 @@ goog.require('ol.Feature');
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.geom.Point');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector');
goog.require('ol.renderer.canvas.Layer');
goog.require('ol.renderer.canvas.Map');