|
Lines 33-39
Link Here
|
| 33 |
namespace UiaAtkBridgeTest |
33 |
namespace UiaAtkBridgeTest |
| 34 |
{ |
34 |
{ |
| 35 |
|
35 |
|
| 36 |
public abstract class AtkTester { |
36 |
public abstract class AtkTester : TestBase { |
| 37 |
|
37 |
|
| 38 |
public abstract Atk.Object GetAccessible (BasicWidgetType type); |
38 |
public abstract Atk.Object GetAccessible (BasicWidgetType type); |
| 39 |
|
39 |
|
|
Lines 343-348
Link Here
|
| 343 |
"menu child of combobox should be visible and showing NOW!"); |
343 |
"menu child of combobox should be visible and showing NOW!"); |
| 344 |
} |
344 |
} |
| 345 |
|
345 |
|
|
|
346 |
GlibSync (); |
| 346 |
if (type == BasicWidgetType.ComboBoxItem) |
347 |
if (type == BasicWidgetType.ComboBoxItem) |
| 347 |
Assert.AreEqual (accessible.Name, accessible.Parent.Parent.Name, "action on combobox item should yield selection"); |
348 |
Assert.AreEqual (accessible.Name, accessible.Parent.Parent.Name, "action on combobox item should yield selection"); |
| 348 |
|
349 |
|
|
Lines 561-566
Link Here
|
| 561 |
type == BasicWidgetType.ListBox || |
562 |
type == BasicWidgetType.ListBox || |
| 562 |
type == BasicWidgetType.CheckedListBox) |
563 |
type == BasicWidgetType.CheckedListBox) |
| 563 |
accName = null; |
564 |
accName = null; |
|
|
565 |
GlibSync (); |
| 564 |
Assert.AreEqual (accName, accessible.Name, "AtkObj Name #" + i + ", we got: " + accessible.Name); |
566 |
Assert.AreEqual (accName, accessible.Name, "AtkObj Name #" + i + ", we got: " + accessible.Name); |
| 565 |
|
567 |
|
| 566 |
Atk.Object refSelObj = implementor.RefSelection (0); |
568 |
Atk.Object refSelObj = implementor.RefSelection (0); |
|
Lines 949-954
Link Here
|
| 949 |
|
951 |
|
| 950 |
protected void PropertyRole (BasicWidgetType type, Atk.Object accessible) |
952 |
protected void PropertyRole (BasicWidgetType type, Atk.Object accessible) |
| 951 |
{ |
953 |
{ |
|
|
954 |
GlibSync (); |
| 952 |
Atk.Role role = GetRole (type); |
955 |
Atk.Role role = GetRole (type); |
| 953 |
Assert.AreEqual (role, accessible.Role, "Atk.Role, we got " + accessible.Role); |
956 |
Assert.AreEqual (role, accessible.Role, "Atk.Role, we got " + accessible.Role); |
| 954 |
} |
957 |
} |
|
Lines 1918-1956
Link Here
|
| 1918 |
" contains the following states: " + res); |
1921 |
" contains the following states: " + res); |
| 1919 |
} |
1922 |
} |
| 1920 |
|
1923 |
|
| 1921 |
public static void States (Atk.Object accessible, params Atk.StateType [] expected) |
|
|
| 1922 |
{ |
| 1923 |
List <Atk.StateType> expectedStates = new List <Atk.StateType> (expected); |
| 1924 |
List <Atk.StateType> missingStates = new List <Atk.StateType> (); |
| 1925 |
List <Atk.StateType> superfluousStates = new List <Atk.StateType> (); |
| 1926 |
|
| 1927 |
Atk.StateSet stateSet = accessible.RefStateSet (); |
| 1928 |
foreach (Atk.StateType state in Enum.GetValues (typeof (Atk.StateType))) { |
| 1929 |
if (expectedStates.Contains (state) && |
| 1930 |
(!(stateSet.ContainsState (state)))) |
| 1931 |
missingStates.Add (state); |
| 1932 |
else if ((!expectedStates.Contains (state)) && |
| 1933 |
(stateSet.ContainsState (state))) |
| 1934 |
superfluousStates.Add (state); |
| 1935 |
} |
| 1936 |
|
| 1937 |
string missingStatesMsg = string.Empty; |
| 1938 |
string superfluousStatesMsg = string.Empty; |
| 1939 |
|
| 1940 |
if (missingStates.Count != 0) { |
| 1941 |
missingStatesMsg = "Missing states: "; |
| 1942 |
foreach (Atk.StateType state in missingStates) |
| 1943 |
missingStatesMsg += state.ToString () + ","; |
| 1944 |
} |
| 1945 |
if (superfluousStates.Count != 0) { |
| 1946 |
superfluousStatesMsg = "Superfluous states: "; |
| 1947 |
foreach (Atk.StateType state in superfluousStates) |
| 1948 |
superfluousStatesMsg += state.ToString () + ","; |
| 1949 |
} |
| 1950 |
Assert.IsTrue ((missingStates.Count == 0) && (superfluousStates.Count == 0), |
| 1951 |
missingStatesMsg + " .. " + superfluousStatesMsg); |
| 1952 |
} |
| 1953 |
|
| 1954 |
protected void Relations (Atk.Object accessible, BasicWidgetType type) |
1924 |
protected void Relations (Atk.Object accessible, BasicWidgetType type) |
| 1955 |
{ |
1925 |
{ |
| 1956 |
if (type != BasicWidgetType.RadioButton) { |
1926 |
if (type != BasicWidgetType.RadioButton) { |
|
Lines 2151-2156
Link Here
|
| 2151 |
Atk.Component atkComponent = CastToAtkInterface<Atk.Component> (accessible); |
2121 |
Atk.Component atkComponent = CastToAtkInterface<Atk.Component> (accessible); |
| 2152 |
EventMonitor.Start (); |
2122 |
EventMonitor.Start (); |
| 2153 |
atkComponent.GrabFocus (); |
2123 |
atkComponent.GrabFocus (); |
|
|
2124 |
GlibSync (); |
| 2154 |
EventCollection events = EventMonitor.Pause (); |
2125 |
EventCollection events = EventMonitor.Pause (); |
| 2155 |
int expectedCount = (transient ? 1 : 2); |
2126 |
int expectedCount = (transient ? 1 : 2); |
| 2156 |
string evType = (transient? "object:active-descendant-changed": "object:state-changed:focused"); |
2127 |
string evType = (transient? "object:active-descendant-changed": "object:state-changed:focused"); |
|
Lines 2194-2243
Link Here
|
| 2194 |
return value.SetCurrentValue (gv); |
2165 |
return value.SetCurrentValue (gv); |
| 2195 |
} |
2166 |
} |
| 2196 |
|
2167 |
|
| 2197 |
private EventCollection events = null; |
|
|
| 2198 |
|
| 2199 |
protected void StartEventMonitor () |
| 2200 |
{ |
| 2201 |
events = null; |
| 2202 |
EventMonitor.Start (); |
| 2203 |
} |
| 2204 |
|
| 2205 |
protected void ExpectEvents (int count, Atk.Role role, string evType) |
| 2206 |
{ |
| 2207 |
if (events == null) |
| 2208 |
events = EventMonitor.Pause (); |
| 2209 |
EventCollection evs = events.FindByRole (role).FindByType (evType); |
| 2210 |
string eventsInXml = String.Format (" events in XML: {0}", Environment.NewLine + events.OriginalGrossXml); |
| 2211 |
Assert.AreEqual (count, evs.Count, "bad number of " + evType + " events: " + eventsInXml); |
| 2212 |
} |
| 2213 |
|
| 2214 |
protected void ExpectEvents (int count, Atk.Role role, string evType, int detail1) |
| 2215 |
{ |
| 2216 |
if (events == null) |
| 2217 |
events = EventMonitor.Pause (); |
| 2218 |
EventCollection evs = events.FindByRole (role).FindByType (evType).FindWithDetail1 (detail1.ToString ()); |
| 2219 |
string eventsInXml = String.Format (" events in XML: {0}", Environment.NewLine + events.OriginalGrossXml); |
| 2220 |
Assert.AreEqual (count, evs.Count, "bad number of " + evType + " events: " + eventsInXml); |
| 2221 |
} |
| 2222 |
|
| 2223 |
protected void ExpectEvents (int count, Atk.Role role, string evType, string name) |
| 2224 |
{ |
| 2225 |
if (events == null) |
| 2226 |
events = EventMonitor.Pause (); |
| 2227 |
EventCollection evs = events.FindByRole (role).FindByType (evType).FindByName (name); |
| 2228 |
string eventsInXml = String.Format (" events in XML: {0}", Environment.NewLine + events.OriginalGrossXml); |
| 2229 |
Assert.AreEqual (count, evs.Count, "bad number of " + evType + " events: " + eventsInXml); |
| 2230 |
} |
| 2231 |
|
| 2232 |
protected void ExpectEvents (int min, int max, Atk.Role role, string evType) |
| 2233 |
{ |
| 2234 |
if (events == null) |
| 2235 |
events = EventMonitor.Pause (); |
| 2236 |
EventCollection evs = events.FindByRole (role).FindByType (evType); |
| 2237 |
string eventsInXml = String.Format (" events in XML: {0}", Environment.NewLine + events.OriginalGrossXml); |
| 2238 |
Assert.IsTrue (evs.Count >= min && evs.Count <= max, "Expected " + min +"-" + max +" " + evType + " events but got " + evs.Count +": " + eventsInXml); |
| 2239 |
} |
| 2240 |
|
| 2241 |
protected bool DoActionByName (Atk.Object accessible, string name) |
2168 |
protected bool DoActionByName (Atk.Object accessible, string name) |
| 2242 |
{ |
2169 |
{ |
| 2243 |
Atk.Action atkAction = CastToAtkInterface<Atk.Action> (accessible); |
2170 |
Atk.Action atkAction = CastToAtkInterface<Atk.Action> (accessible); |