Inheritance: IDisposable
Example #1
0
        public void ThreadExceptionDialog()
        {
            System.Exception exception = new System.Exception();
            try {
                int zero = 0;
                int x    = 1 / zero;
                zero = x;
            } catch (System.Exception e) {
                exception = e;
            }

            using (var runner = new DialogRunner(new SWF.ThreadExceptionDialog(exception))) {
                VerifyBasicProperties(runner.Dialog);
            }
        }
Example #2
0
		public void OpenFileDialog ()
		{
			using (var runner = new DialogRunner (new SWF.OpenFileDialog ())) {
				VerifyBasicProperties (runner.Dialog);

				UiaAtkBridge.Window dialogAdapter =
					BridgeTester.GetAdapterForWidget (runner.Dialog) as UiaAtkBridge.Window;

				Atk.Object popupButtonPanelAdapter = dialogAdapter.RefAccessibleChild (10);
				Assert.AreEqual (5, popupButtonPanelAdapter.NAccessibleChildren, "PopupButtonPanel (toolbar) should have 5 children");

				Atk.Object popupButtonAdapter1 = popupButtonPanelAdapter.RefAccessibleChild (0).RefAccessibleChild (0);
				AtkTester.States (popupButtonAdapter1,
				                  Atk.StateType.Enabled,
				                  Atk.StateType.Selectable,
				                  Atk.StateType.Focusable,
				                  Atk.StateType.Sensitive,
				                  Atk.StateType.Showing,
				                  Atk.StateType.Visible);

				// TODO: Enable the below if we find a way
				// to get the MWFFileView to update
				//Atk.Object treeTable = dialogAdapter.RefAccessibleChild (3);
				//Assert.AreEqual (Atk.Role.TreeTable, treeTable.Role, "TreeTable Role");
				//Atk.Object tableCell = treeTable.RefAccessibleChild (1);;
				//Assert.IsNotNull (tableCell, "TableCell should not be null");
				//Assert.AreEqual (Atk.Role.TableCell, tableCell.Role, "TableCell role");
				//Atk.Action atkAction = Atk.ActionAdapter.GetObject (tableCell.Handle, false);
				//Assert.AreEqual (2, atkAction.NActions, "TableCell NActions");
				//Assert.AreEqual ("invoke", atkAction.GetName (1), "TableCell Action.GetName (1)");

				Atk.Object comboBox = dialogAdapter.RefAccessibleChild (8);
				Assert.AreEqual (Atk.Role.ComboBox, comboBox.Role, "ComboBox Role");
				Atk.Object list = comboBox.RefAccessibleChild (0);
				Assert.IsTrue (list.NAccessibleChildren > 0, "ComboBox child should have children");
				EventMonitor.Start ();
				Atk.ISelection atkSelection = Atk.SelectionAdapter.GetObject (list.Handle, false);
				atkSelection.AddSelection (5);
				string evType = "object:state-changed:selected";
				EventCollection events = EventMonitor.Pause ();
				EventCollection evs = events.FindByType (evType).FindWithDetail1 ("1");
				string eventsInXml = String.Format (" events in XML: {0}", Environment.NewLine + events.OriginalGrossXml);
				Assert.IsTrue (evs.Count > 0, "bad number of " + evType + " events: " + eventsInXml);
			}
		}
Example #3
0
        public void OpenFileDialog()
        {
            using (var runner = new DialogRunner(new SWF.OpenFileDialog())) {
                VerifyBasicProperties(runner.Dialog);

                UiaAtkBridge.Window dialogAdapter =
                    BridgeTester.GetAdapterForWidget(runner.Dialog) as UiaAtkBridge.Window;

                Atk.Object popupButtonPanelAdapter = dialogAdapter.RefAccessibleChild(10);
                Assert.AreEqual(5, popupButtonPanelAdapter.NAccessibleChildren, "PopupButtonPanel (toolbar) should have 5 children");

                Atk.Object popupButtonAdapter1 = popupButtonPanelAdapter.RefAccessibleChild(0).RefAccessibleChild(0);
                AtkTester.States(popupButtonAdapter1,
                                 Atk.StateType.Enabled,
                                 Atk.StateType.Selectable,
                                 Atk.StateType.Focusable,
                                 Atk.StateType.Sensitive,
                                 Atk.StateType.Showing,
                                 Atk.StateType.Visible);

                // TODO: Enable the below if we find a way
                // to get the MWFFileView to update
                //Atk.Object treeTable = dialogAdapter.RefAccessibleChild (3);
                //Assert.AreEqual (Atk.Role.TreeTable, treeTable.Role, "TreeTable Role");
                //Atk.Object tableCell = treeTable.RefAccessibleChild (1);;
                //Assert.IsNotNull (tableCell, "TableCell should not be null");
                //Assert.AreEqual (Atk.Role.TableCell, tableCell.Role, "TableCell role");
                //Atk.Action atkAction = Atk.ActionAdapter.GetObject (tableCell.Handle, false);
                //Assert.AreEqual (2, atkAction.NActions, "TableCell NActions");
                //Assert.AreEqual ("invoke", atkAction.GetName (1), "TableCell Action.GetName (1)");

                Atk.Object comboBox = dialogAdapter.RefAccessibleChild(8);
                Assert.AreEqual(Atk.Role.ComboBox, comboBox.Role, "ComboBox Role");
                Atk.Object list = comboBox.RefAccessibleChild(0);
                Assert.IsTrue(list.NAccessibleChildren > 0, "ComboBox child should have children");
                EventMonitor.Start();
                Atk.ISelection atkSelection = Atk.SelectionAdapter.GetObject(list.Handle, false);
                atkSelection.AddSelection(5);
                string          evType      = "object:state-changed:selected";
                EventCollection events      = EventMonitor.Pause();
                EventCollection evs         = events.FindByType(evType).FindWithDetail1("1");
                string          eventsInXml = String.Format(" events in XML: {0}", Environment.NewLine + events.OriginalGrossXml);
                Assert.IsTrue(evs.Count > 0, "bad number of " + evType + " events: " + eventsInXml);
            }
        }
Example #4
0
		public void ColorDialog ()
		{
			using (var runner = new DialogRunner (new SWF.ColorDialog ())) {
				VerifyBasicProperties (runner.Dialog);
			}
		}
Example #5
0
		public void SaveFileDialog ()
		{
			using (var runner = new DialogRunner (new SWF.SaveFileDialog ())) {
				VerifyBasicProperties (runner.Dialog);
			}
		}
Example #6
0
		public void ThreadExceptionDialog ()
		{
			System.Exception exception = new System.Exception ();
			try {
			int zero = 0;
				int x = 1 / zero;
				zero = x;
			} catch (System.Exception e) {
				exception = e;
			}

			using (var runner = new DialogRunner (new SWF.ThreadExceptionDialog (exception))) {
				VerifyBasicProperties (runner.Dialog);
			}
		}
Example #7
0
 public void FontDialog()
 {
     using (var runner = new DialogRunner(new SWF.FontDialog())) {
         VerifyBasicProperties(runner.Dialog);
     }
 }