WMSGetFeatureInfo: add beforegetfeatureinfo event, p=fvanderbiest, r=me (closes #2127)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@9569 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2009-07-20 09:07:37 +00:00
parent 4e77c9648a
commit feb29516b3
2 changed files with 38 additions and 2 deletions

View File

@@ -70,7 +70,38 @@
control.getInfoForClick({xy: {x: 50, y: 50}});
control.getInfoForHover({xy: {x: 50, y: 50}});
}
function test_beforegetfeatureinfo_event(t) {
t.plan(2);
var map = new OpenLayers.Map('map');
var xy, mode;
// mock up active control
var control = new OpenLayers.Control.WMSGetFeatureInfo({
request: function(position) {},
eventListeners: {
beforegetfeatureinfo: function(evt) {
t.eq(evt.xy, xy,
"beforegetfeatureinfo listener gets " +
"expected xy (" + mode + ")");
}
}
});
map.addControl(control);
control.activate();
// 1 test
mode = "click";
xy = {x: 50, y: 50};
control.getInfoForClick({xy: xy});
// 1 test
mode = "hover";
xy = {x: 70, y: 70};
control.getInfoForHover({xy: xy});
}
function test_activate(t) {
t.plan(4);
var map = new OpenLayers.Map("map");