Наследование: IDisposable
Пример #1
0
        public void Init()
        {
            frame = GetFrame ("gtktreeview.py");

            treeTable = FindByRole (frame, Role.TreeTable, true);
            Assert.IsNotNull (treeTable, "Couldn't find the tree table");
        }
Пример #2
0
 public Hyperlink(Accessible accessible, string path)
 {
     application = accessible.application;
     ObjectPath op = new ObjectPath (path);
     proxy = Registry.Bus.GetObject<IHyperlink> (application.name, op);
     properties = Registry.Bus.GetObject<Properties> (application.name, op);
 }
Пример #3
0
        public static void States(Accessible accessible, params StateType [] expected)
        {
            List <StateType> expectedStates = new List <StateType> (expected);
            List <StateType> missingStates = new List <StateType> ();
            List <StateType> superfluousStates = new List <StateType> ();

            StateSet stateSet = accessible.StateSet;
            foreach (StateType state in Enum.GetValues (typeof (StateType))) {
                if (expectedStates.Contains (state) &&
                    (!(stateSet.Contains (state))))
                    missingStates.Add (state);
                else if ((!expectedStates.Contains (state)) &&
                         (stateSet.Contains (state)))
                    superfluousStates.Add (state);
            }

            string missingStatesMsg = string.Empty;
            string superfluousStatesMsg = string.Empty;

            if (missingStates.Count != 0) {
                missingStatesMsg = "Missing states: ";
                foreach (StateType state in missingStates)
                    missingStatesMsg += state.ToString () + ",";
            }
            if (superfluousStates.Count != 0) {
                superfluousStatesMsg = "Superfluous states: ";
                foreach (StateType state in superfluousStates)
                    superfluousStatesMsg += state.ToString () + ",";
            }
            Assert.IsTrue ((missingStates.Count == 0) && (superfluousStates.Count == 0),
                missingStatesMsg + " .. " + superfluousStatesMsg);
        }
Пример #4
0
        public HypertextTest()
        {
            frame = GetFrame ("DocumentTest.exe", "DocumentTest");

            hypertext = frame.QueryHypertext ();
            Assert.IsNotNull (hypertext, "frame.QueryHypertext");
        }
Пример #5
0
        public DocumentTest()
        {
            frame = GetFrame ("DocumentTest.exe", "DocumentTest");

            document = frame.QueryDocument ();
            Assert.IsNotNull (document, "frame.QueryDocument");
        }
Пример #6
0
 public StateSet(Accessible accessible, uint [] states)
 {
     this.accessible = accessible;
     if (states.Length != 2)
         throw new ArgumentException ("Expecting int [2]");
     this.states = (((ulong) states [1]) << (sizeof (int) * 8)) | (ulong)states [0];
 }
Пример #7
0
 public AccessibleTest()
 {
     radioButtonFrame = GetFrame ("gtkradiobutton.py");
     buttonFrame = GetFrame ("gtkbutton.py");
     radioButton = FindByRole (radioButtonFrame, Role.RadioButton, true);
     Assert.IsNotNull (radioButton, "Find radioButton");
     documentFrame = GetFrame ("DocumentTest.exe", "DocumentTest");
 }
 public DeviceEventControllerTest()
 {
     // We need a gtk app so that our keystrokes have a
     // place to land where they will be ricocheted
     // back to our listener.
     frame = GetFrame ("gtktextview.py");
     Assert.IsNotNull (frame, "Couldn't open gtktextview.py");
 }
Пример #9
0
		private void OnRowInserted (Accessible sender, int row, int count)
		{
			EnsureRowsSize (row + count);
			int lim = row + count;
			for (int i = row; i < lim; i++)
				rows.Insert (i, null);
			AdjustRowReferences (row + count);
		}
Пример #10
0
		public TableElement (Accessible accessible) : base (accessible)
		{
			header = null;
			table = accessible.QueryTable ();
			RefreshTreeMode (true);
			accessible.ObjectEvents.RowInserted += OnRowInserted;
			accessible.ObjectEvents.RowDeleted += OnRowDeleted;
			AddEvents (false);
		}
Пример #11
0
        public SelectionTest()
        {
            frame = GetFrame ("gtkmenubar.py");

            menuBar = FindByRole (frame, Role.MenuBar);
            Assert.IsNotNull (menuBar, "Couldn't find the menu bar");
            selection = menuBar.QuerySelection ();
            Assert.IsNotNull (selection, "menuBar.QuerySelection");
        }
Пример #12
0
        public TableTest()
        {
            frame = GetFrame ("gtktreeview.py");

            treeTable = FindByRole (frame, Role.TreeTable, true);
            Assert.IsNotNull (treeTable, "Couldn't find the tree table");
            table = treeTable.QueryTable ();
            Assert.IsNotNull (table, "menuBar.QueryTable");
        }
Пример #13
0
        public ActionTest()
        {
            frame = GetFrame ("gtkbutton.py");

            Accessible button = FindByRole (frame, Role.PushButton);
            Assert.IsNotNull (button, "Couldn't find the PushButton");
            action = button.QueryAction ();
            Assert.IsNotNull (action, "button.QueryAction");
        }
Пример #14
0
		private void OnColumnDeleted (Accessible sender, int row, int nDeleted)
		{
			int newVal = element.accessible.QueryTable ().NColumns;
			AutomationSource.RaisePropertyChangedEvent (
				element,
				GridPatternIdentifiers.ColumnCountProperty,
				newVal + nDeleted,
				newVal);
		}
Пример #15
0
        public ValueTest()
        {
            frame = GetFrame ("gtkhscale.py");

            Accessible slider = FindByRole (frame, Role.Slider);
            Assert.IsNotNull (slider, "Couldn't find the Slider");
            value = slider.QueryValue ();
            Assert.IsNotNull (value, "slider.QueryValue");
        }
Пример #16
0
		private void OnRowInserted (Accessible sender, int row, int nInserted)
		{
			int newVal = element.accessible.QueryTable ().NRows;
			AutomationSource.RaisePropertyChangedEvent (
				element,
				GridPatternIdentifiers.RowCountProperty,
				newVal - nInserted,
				newVal);
		}
Пример #17
0
		private bool AccessibleIsEnabled (Accessible accessible)
		{
			if (accessible.Parent == null || accessible.Role == Role.Application)
				return true;
			// Work around gail notifying for Sensitive but not
			// Enabled
			if (!accessible.StateSet.Contains (StateType.Enabled) || !accessible.StateSet.Contains (StateType.Sensitive))
				return false;
			return AccessibleIsEnabled (accessible.Parent);
		}
Пример #18
0
		private void OnSelectionChanged (Accessible sender)
		{
			IElement [] newSelection = source.GetSelection ();

			AutomationSource.RaisePropertyChangedEvent (element,
			                                            SelectionPattern.SelectionProperty,
								    oldSelection ?? new IElement [0],
								    newSelection ?? new IElement [0]);
			oldSelection = newSelection;
		}
Пример #19
0
        public TextTest()
        {
            frame = GetFrame ("gtktextview.py");

            Accessible textView = FindByRole (frame, Role.Text);
            Assert.IsNotNull (textView, "Couldn't find the TextView");
            text = textView.QueryText ();
            Assert.IsNotNull (text, "textView.QueryText");
            editableText = textView.QueryEditableText ();
            Assert.IsNotNull (editableText, "textView.QueryEditableText");
        }
Пример #20
0
        public ImageTest()
        {
            frame = GetFrame ("gtkbutton.py");

            Accessible button = Find (frame, Role.PushButton, "openSUSE", true);
            Assert.IsNotNull (button, "Couldn't find the PushButton");
            // It seems that the image needs time to load?
            System.Threading.Thread.Sleep (500);
            image = button.QueryImage ();
            Assert.IsNotNull (image, "button.QueryImage");
        }
Пример #21
0
		private void OnPropertyChange (Accessible sender, string name, object any)
		{
			if (name != "accessible-value")
				return;
			double newVal = Value.CurrentValue;
			AutomationSource.RaisePropertyChangedEvent (
				element,
				RangeValuePatternIdentifiers.ValueProperty,
				currentValue,
				newVal);
			currentValue = newVal;
		}
Пример #22
0
		private void OnTextChanged (Accessible sender, string detail, int v1, int v2, string any)
		{
			string newValue = Text.GetText ();
			if (newValue == currentValue)
				return;

			// LAMESPEC: Client tests confirm OldValue is null.
			AutomationSource.RaisePropertyChangedEvent (element,
			                                            ValuePattern.ValueProperty,
								    null,
								    newValue);
			currentValue = newValue;
		}
Пример #23
0
		public ExpandCollapseSource (Element element)
		{
			accessible = (element is DataItemElement
				? ((Element)element.FirstChild).Accessible
			: element.Accessible);
			action = accessible.QueryAction ();

			ActionDescription [] actions = action.Actions;
			for (int i = 0; i < actions.Length; i++) {
				if (actions [i].Name == "expand or contract" ||
					actions [i].Name == "expand or collapse") {
					expandOrContractAction = i;
					break;
				}
			}
		}
Пример #24
0
		private void OnBoundsChanged (Accessible sender, BoundingBox bounds)
		{
			Rect rect = BoundingBoxToRect (bounds);
			AtspiUiaSource.AutomationSource.RaisePropertyChangedEvent (this,
				AutomationElement.BoundingRectangleProperty,
				Rect.Empty,
				rect);
		}
Пример #25
0
		private static bool IsTreeItem (Accessible accessible)
		{
			if (accessible.Role != Role.TableCell)
				return false;
			Accessible parentAccessible = accessible.Parent;
			Element parent = GetElement (parentAccessible);
			return (parent is TreeItemElement ||
				parent.ControlType == ControlType.Tree);
		}
Пример #26
0
		private static bool IsTableHeaderItem (Accessible accessible)
		{
			return (accessible.Role == Role.TableRowHeader
				|| accessible.Role == Role.TableColumnHeader);
		}
Пример #27
0
		private static bool IsTable (Accessible accessible)
		{
			if (accessible.Role == Role.Table)
				return true;
			if (accessible.Role != Role.TreeTable)
				return false;
			Atspi.Table table = accessible.QueryTable ();
			return (table != null);
		}
Пример #28
0
		internal static Element GetElement (Accessible accessible, DataItemElement parent, int column)
		{
			if (accessible == null)
				return null;
			if (elements.ContainsKey (accessible))
				return elements [accessible];
			elements [accessible] = new TableCellElement (accessible, parent, column);
			return elements [accessible];
		}
Пример #29
0
		internal static Element GetElement (Accessible accessible, TableElement parent, int row)
		{
			if (accessible == null)
				return null;
			if (elements.ContainsKey (accessible))
				return elements [accessible];
			elements [accessible] = new TreeItemElement (accessible, parent, row);
			return elements [accessible];
		}
Пример #30
0
		internal static Element GetElement (Accessible accessible, bool create)
		{
			if (accessible == null)
				return null;
			// We expose the children of Applications as top-level,
			// to be more like UIA
			if (accessible.Role == Role.Application)
				return null;
			if (elements.ContainsKey (accessible))
			return elements [accessible];
			if (!create)
				return null;
			Element element;
			if (IsTable (accessible))
				element = new TableElement (accessible);
			else if (IsTableHeaderItem (accessible))
				element = new TableHeaderItemElement (accessible);
			else if (IsTreeItem (accessible))
				element = new TreeItemElement (accessible);
			else
				element = new Element (accessible);
			return element;
		}