Inheritance: IDisposable
Exemplo n.º 1
0
        public void Init()
        {
            frame = GetFrame ("gtktreeview.py");

            treeTable = FindByRole (frame, Role.TreeTable, true);
            Assert.IsNotNull (treeTable, "Couldn't find the tree table");
        }
Exemplo n.º 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);
 }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
        public HypertextTest()
        {
            frame = GetFrame ("DocumentTest.exe", "DocumentTest");

            hypertext = frame.QueryHypertext ();
            Assert.IsNotNull (hypertext, "frame.QueryHypertext");
        }
Exemplo n.º 5
0
        public DocumentTest()
        {
            frame = GetFrame ("DocumentTest.exe", "DocumentTest");

            document = frame.QueryDocument ();
            Assert.IsNotNull (document, "frame.QueryDocument");
        }
Exemplo n.º 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];
 }
Exemplo n.º 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");
 }
Exemplo n.º 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);
		}
Exemplo n.º 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);
		}
Exemplo n.º 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");
        }
Exemplo n.º 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");
        }
Exemplo n.º 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");
        }
Exemplo n.º 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);
		}
Exemplo n.º 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");
        }
Exemplo n.º 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);
		}
Exemplo n.º 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);
		}
Exemplo n.º 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;
		}
Exemplo n.º 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");
        }
Exemplo n.º 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");
        }
Exemplo n.º 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;
		}
Exemplo n.º 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;
		}
Exemplo n.º 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;
				}
			}
		}
Exemplo n.º 24
0
		private void OnBoundsChanged (Accessible sender, BoundingBox bounds)
		{
			Rect rect = BoundingBoxToRect (bounds);
			AtspiUiaSource.AutomationSource.RaisePropertyChangedEvent (this,
				AutomationElement.BoundingRectangleProperty,
				Rect.Empty,
				rect);
		}
Exemplo n.º 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);
		}
Exemplo n.º 26
0
		private static bool IsTableHeaderItem (Accessible accessible)
		{
			return (accessible.Role == Role.TableRowHeader
				|| accessible.Role == Role.TableColumnHeader);
		}
Exemplo n.º 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);
		}
Exemplo n.º 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];
		}
Exemplo n.º 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];
		}
Exemplo n.º 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;
		}