Do not change the active state of button controls on a panel when a tool control is activated. p=jorix, r=me (closes #2764)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@10576 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
t.eq( control.displayClass, "olControlPanel", "displayClass is correct" );
|
||||
}
|
||||
function test_Control_Panel_constructor2 (t) {
|
||||
t.plan(11);
|
||||
t.plan(16);
|
||||
var map = new OpenLayers.Map('map');
|
||||
var toolControl = new OpenLayers.Control.ZoomBox();
|
||||
var AnotherToolControl = OpenLayers.Class(OpenLayers.Control, {
|
||||
@@ -24,6 +24,11 @@
|
||||
});
|
||||
|
||||
var toggleControl = new ToggleControl();
|
||||
var buttonControl = new OpenLayers.Control.Button({
|
||||
trigger: function () {
|
||||
t.ok(true, "trigger function of button is called.");
|
||||
}
|
||||
});
|
||||
|
||||
var panel = new OpenLayers.Control.Panel(
|
||||
{defaultControl: anotherToolControl});
|
||||
@@ -36,6 +41,7 @@
|
||||
panel.addControls([toolControl, anotherToolControl, toggleControl]);
|
||||
t.eq(panel.controls.length, 3,
|
||||
"added three controls to the panel");
|
||||
panel.addControls([buttonControl]);
|
||||
|
||||
panel.redrawsCount = 0;
|
||||
map.addControl(panel);
|
||||
@@ -56,15 +62,23 @@
|
||||
panel.redrawsCount + " times.");
|
||||
|
||||
panel.activateControl(toolControl);
|
||||
t.ok(toolControl.active && !anotherToolControl.active && !toggleControl.active,
|
||||
"activated one tool control, the other one is inactive and the toggle control also.");
|
||||
t.ok(toolControl.active && !anotherToolControl.active && !toggleControl.active && !buttonControl.active,
|
||||
"activated one tool control, the other one is inactive and the toggle & button controls also.");
|
||||
|
||||
panel.redrawsCount = 0;
|
||||
panel.activateControl(toggleControl);
|
||||
t.ok((panel.redrawsCount > 0),"Redraw called on activated toggle " +
|
||||
panel.redrawsCount + " times.");
|
||||
t.ok(toolControl.active && !anotherToolControl.active && toggleControl.active,
|
||||
"activated the toggle control, which has no influence on the tool controls.");
|
||||
"activated the toggle control, which has no influence on the tool & togggle controls.");
|
||||
panel.activateControl(buttonControl);
|
||||
t.ok(toolControl.active && !anotherToolControl.active && toggleControl.active,
|
||||
"activateContol calling for button, which has no influence on the tool & togggle controls.");
|
||||
t.ok(!buttonControl.active,
|
||||
"activateContol calling for button, button remains inactive.");
|
||||
buttonControl.activate();
|
||||
t.ok(buttonControl.active && toolControl.active && !anotherToolControl.active && toggleControl.active,
|
||||
"activated the button control, which has no influence on the tool & togggle controls.");
|
||||
|
||||
panel.redrawsCount = 0;
|
||||
panel.activateControl(anotherToolControl);
|
||||
@@ -73,6 +87,8 @@
|
||||
" times.");
|
||||
t.ok(!toolControl.active && anotherToolControl.active && toggleControl.active,
|
||||
"activated the other tool control, the first one is inactive and the toggle control still active.");
|
||||
t.ok(buttonControl.active,
|
||||
"activated the other tool control, the button control still active.");
|
||||
}
|
||||
function test_Control_Panel_titles (t) {
|
||||
t.plan(2);
|
||||
|
||||
Reference in New Issue
Block a user