public void ParentMenu_ChildrenStates ()
{
BasicWidgetType type = BasicWidgetType.ParentMenu;
Atk.Object accessible = null;
string menuName = "File";
MenuLayout [] firstSubmenus = new MenuLayout [] { new MenuLayout ("New...", new MenuLayout ("Project"), new MenuLayout ("Text")), new MenuLayout ("Quit!") };
List <MenuLayout> menu = new List <MenuLayout> ();
menu.Add (new MenuLayout (menuName, firstSubmenus));
menu.Add (new MenuLayout ("Help", new MenuLayout ("About?")));
accessible = GetAccessible (type, menu);
List <string> names = new List <string> ();
names.Add (menuName);
foreach (MenuLayout submenu in firstSubmenus)
names.Add (submenu.Label);
//we check this when the ParentMenu is open (bnc#479397)
int j = 0;
names.Remove (menuName);
RunInGuiThread (delegate () {
CastToAtkInterface <Atk.IAction> (accessible).DoAction (0);
});
Atk.ISelection atkSelection = CastToAtkInterface <Atk.ISelection> (accessible);
Assert.IsTrue (accessible.RefAccessibleChild (0).RefStateSet ().ContainsState (Atk.StateType.Showing));
foreach (string name in names) {
Assert.AreEqual (accessible.RefAccessibleChild (j).Name, name);
States (accessible.RefAccessibleChild (j),
Atk.StateType.Enabled,
IsBGO580460Addressed () ? Atk.StateType.Focusable : Atk.StateType.Enabled,
Atk.StateType.Selectable,
Atk.StateType.Sensitive,
Atk.StateType.Showing,
Atk.StateType.Visible);
atkSelection.AddSelection (j);
States (accessible.RefAccessibleChild (j),
Atk.StateType.Enabled,
(IsBGO580452Addressed () || j != 0) ? Atk.StateType.Focused : Atk.StateType.Enabled,
IsBGO580452Addressed () ? Atk.StateType.Focusable : Atk.StateType.Enabled,
Atk.StateType.Selected,
Atk.StateType.Selectable,
Atk.StateType.Sensitive,
Atk.StateType.Showing,
Atk.StateType.Visible);
j++;
}
}