Exemple #1
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);
            }
        }
Exemple #2
0
 //TODO: test Atk.Role.Dialog when using ShowDialog() [currently threading problems]
 private void VerifyBasicProperties(System.ComponentModel.Component dialog)
 {
     UiaAtkBridge.Window dialogAdapter = BridgeTester.GetAdapterForWidget(dialog) as UiaAtkBridge.Window;
     Assert.IsNotNull(dialogAdapter, "dialogAdapter has a different type than Window");
     Assert.IsTrue(dialogAdapter.NAccessibleChildren > 0, "dialog should have children");
 }