UiaAtkBridgeTest.AtkTests.MainMenuBar C# (CSharp) Method

MainMenuBar() private method

private MainMenuBar ( ) : void
return void
		public void MainMenuBar ()
		{
			BasicWidgetType type = BasicWidgetType.MainMenuBar;
			Atk.Object accessible = null;
			
			List <MenuLayout> menu = new List <MenuLayout> ();
			menu.Add (new MenuLayout ("XFile", new MenuLayout ("New...", new MenuLayout ("Project"), new MenuLayout ("Text")), new MenuLayout ("Quit!")));
			menu.Add (new MenuLayout ("GimmeHelp", new MenuLayout ("About?")));
			
			accessible = GetAccessible (type, menu);
			Interfaces (accessible,
			            typeof (Atk.IComponent),
			            typeof (Atk.ISelection));
			
			Assert.IsNull (accessible.Name, "name of the menubar should be null, now it's:" + accessible.Name);
			
			States (accessible,
			  Atk.StateType.Enabled, 
			  Atk.StateType.Sensitive,
			  Atk.StateType.Showing,
			  Atk.StateType.Visible);

			PropertyRole (type, accessible);

			Assert.AreEqual (menu.Count, accessible.NAccessibleChildren, 
			                 "number of children; children roles:" + DescribeChildren (accessible));

			for (int i = 0; i < accessible.NAccessibleChildren; i++) {
				Atk.Object parentMenuChild = accessible.RefAccessibleChild (i);
				Assert.IsNotNull (parentMenuChild, "menubar child#" + i + " should not be null");

				Assert.AreEqual ( //FIXME: check if it's possible to have a MenuItem alone (like a push button)
				  parentMenuChild.Role, Atk.Role.Menu, "menubar children should have Menu role");
				Assert.AreEqual (menu [i].Label, parentMenuChild.Name, "name of the parentmenu is the same as its label");
			}

			Atk.IComponent atkComponent = CastToAtkInterface <Atk.IComponent> (accessible);
			InterfaceComponent (type, atkComponent);

			List <string> names = new List <string> ();
			foreach (MenuLayout submenu in menu)
				names.Add (submenu.Label);
			Atk.ISelection atkSelection = CastToAtkInterface <Atk.ISelection> (accessible);
			InterfaceSelection (atkSelection, names.ToArray (), accessible, type);
		}