public void Init() { frame = GetFrame ("gtktreeview.py"); treeTable = FindByRole (frame, Role.TreeTable, true); Assert.IsNotNull (treeTable, "Couldn't find the tree table"); }
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); }
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); }
public HypertextTest() { frame = GetFrame ("DocumentTest.exe", "DocumentTest"); hypertext = frame.QueryHypertext (); Assert.IsNotNull (hypertext, "frame.QueryHypertext"); }
public DocumentTest() { frame = GetFrame ("DocumentTest.exe", "DocumentTest"); document = frame.QueryDocument (); Assert.IsNotNull (document, "frame.QueryDocument"); }
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]; }
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"); }
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); }
public TableElement (Accessible accessible) : base (accessible) { header = null; table = accessible.QueryTable (); RefreshTreeMode (true); accessible.ObjectEvents.RowInserted += OnRowInserted; accessible.ObjectEvents.RowDeleted += OnRowDeleted; AddEvents (false); }
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"); }
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"); }
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"); }
private void OnColumnDeleted (Accessible sender, int row, int nDeleted) { int newVal = element.accessible.QueryTable ().NColumns; AutomationSource.RaisePropertyChangedEvent ( element, GridPatternIdentifiers.ColumnCountProperty, newVal + nDeleted, newVal); }
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"); }
private void OnRowInserted (Accessible sender, int row, int nInserted) { int newVal = element.accessible.QueryTable ().NRows; AutomationSource.RaisePropertyChangedEvent ( element, GridPatternIdentifiers.RowCountProperty, newVal - nInserted, newVal); }
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); }
private void OnSelectionChanged (Accessible sender) { IElement [] newSelection = source.GetSelection (); AutomationSource.RaisePropertyChangedEvent (element, SelectionPattern.SelectionProperty, oldSelection ?? new IElement [0], newSelection ?? new IElement [0]); oldSelection = newSelection; }
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"); }
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"); }
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; }
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; }
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; } } }
private void OnBoundsChanged (Accessible sender, BoundingBox bounds) { Rect rect = BoundingBoxToRect (bounds); AtspiUiaSource.AutomationSource.RaisePropertyChangedEvent (this, AutomationElement.BoundingRectangleProperty, Rect.Empty, rect); }
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); }
private static bool IsTableHeaderItem (Accessible accessible) { return (accessible.Role == Role.TableRowHeader || accessible.Role == Role.TableColumnHeader); }
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); }
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]; }
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]; }
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; }