View | Details | Raw Unified | Return to bug 479142
Collapse All | Expand All

(-)Test/AtkTest/AtkTests.cs (-8 / +5 lines)
Lines 953-959 Link Here
953
			InterfaceImage (type, atkWithImage, atkComponent, atkWithoutImage);
953
			InterfaceImage (type, atkWithImage, atkComponent, atkWithoutImage);
954
		}
954
		}
955
955
956
		//[Test]
956
		[Test]
957
		public void ListView ()
957
		public void ListView ()
958
		{
958
		{
959
			BasicWidgetType type = BasicWidgetType.ListView;
959
			BasicWidgetType type = BasicWidgetType.ListView;
Lines 984-990 Link Here
984
			States (accessible,
984
			States (accessible,
985
			  Atk.StateType.Enabled,
985
			  Atk.StateType.Enabled,
986
			  Atk.StateType.Focusable,
986
			  Atk.StateType.Focusable,
987
			  Atk.StateType.Focused, // from InterfaceSelection
988
			  Atk.StateType.ManagesDescendants,
987
			  Atk.StateType.ManagesDescendants,
989
			  Atk.StateType.Sensitive,
988
			  Atk.StateType.Sensitive,
990
			  Atk.StateType.Showing,
989
			  Atk.StateType.Showing,
Lines 997-1006 Link Here
997
			Atk.Object header = FindObjectByRole (accessible, Atk.Role.TableColumnHeader);
996
			Atk.Object header = FindObjectByRole (accessible, Atk.Role.TableColumnHeader);
998
			Assert.IsNotNull (header, "Header not null");
997
			Assert.IsNotNull (header, "Header not null");
999
			States (header,
998
			States (header,
999
			    Atk.StateType.Selectable,
1000
				Atk.StateType.Enabled,
1000
				Atk.StateType.Enabled,
1001
				Atk.StateType.Sensitive,
1001
				Atk.StateType.Sensitive,
1002
				Atk.StateType.Showing,
1002
				Atk.StateType.Showing,
1003
				Atk.StateType.Visible);
1003
				Atk.StateType.Visible);
1004
			Atk.Action action = CastToAtkInterface<Atk.Action> (header);
1005
			InterfaceAction (BasicWidgetType.HeaderItem, action, header);
1004
1006
1005
			Atk.Object child1 = FindObjectByName (accessible, "Programming Windows with C#");
1007
			Atk.Object child1 = FindObjectByName (accessible, "Programming Windows with C#");
1006
			int child1Index = child1.IndexInParent;
1008
			int child1Index = child1.IndexInParent;
Lines 1015-1028 Link Here
1015
1017
1016
			InterfaceText (group, "C#");
1018
			InterfaceText (group, "C#");
1017
1019
1018
			// For some reason, the next line would cause crashes
1020
			Relation (Atk.RelationType.NodeChildOf, child1, group);
1019
			// in later tests.
1020
			//Relation (Atk.RelationType.NodeChildOf, child1, group);
1021
1021
1022
			Assert.AreEqual (3, atkTable.NColumns, "Table NumColumns");
1022
			Assert.AreEqual (3, atkTable.NColumns, "Table NumColumns");
1023
			Assert.AreEqual (1, atkTable.GetRowAtIndex (groupIndex), "GetRowAtIndex");
1024
			Assert.AreEqual (0, atkTable.GetColumnAtIndex (groupIndex), "GetColumnAtIndex");
1025
			Assert.AreEqual (group, atkTable.RefAt (1, 0), "ListView RefAt");
1026
		}
1023
		}
1027
1024
1028
		protected string simpleTable = "<table>"+
1025
		protected string simpleTable = "<table>"+
(-)Test/AtkTest/AtkTester.cs (+2 lines)
Lines 249-254 Link Here
249
			    type == BasicWidgetType.ListItem || 
249
			    type == BasicWidgetType.ListItem || 
250
			    type == BasicWidgetType.ParentMenu ||
250
			    type == BasicWidgetType.ParentMenu ||
251
			    type == BasicWidgetType.ChildMenu ||
251
			    type == BasicWidgetType.ChildMenu ||
252
			    type == BasicWidgetType.HeaderItem ||
252
			    type == BasicWidgetType.Spinner)
253
			    type == BasicWidgetType.Spinner)
253
				validNumberOfActions = 1;
254
				validNumberOfActions = 1;
254
			else if (type == BasicWidgetType.CheckedListItem)
255
			else if (type == BasicWidgetType.CheckedListItem)
Lines 419-424 Link Here
419
420
420
			//sub-items cannot be disabled, mainly because they are not widgets
421
			//sub-items cannot be disabled, mainly because they are not widgets
421
			if ((type != BasicWidgetType.ListItem) &&
422
			if ((type != BasicWidgetType.ListItem) &&
423
			    (type != BasicWidgetType.HeaderItem) &&
422
			    (type != BasicWidgetType.CheckedListItem) &&
424
			    (type != BasicWidgetType.CheckedListItem) &&
423
			    (type != BasicWidgetType.ComboBoxItem)) { //disable a combobox item? let's not try weird things
425
			    (type != BasicWidgetType.ComboBoxItem)) { //disable a combobox item? let's not try weird things
424
				DisableWidget (accessible);
426
				DisableWidget (accessible);
(-)Test/AtkTest/BasicWidgetType.cs (+1 lines)
Lines 49-54 Link Here
49
		TextBoxView,        // textbox multi-line (gtk: textview)
49
		TextBoxView,        // textbox multi-line (gtk: textview)
50
		PasswordCharTextBoxEntry, // textbox with PasswordChar set (gtk: entry with visibility:false)
50
		PasswordCharTextBoxEntry, // textbox with PasswordChar set (gtk: entry with visibility:false)
51
		RichTextBox, // RichTextBox (gtk: textview)
51
		RichTextBox, // RichTextBox (gtk: textview)
52
		HeaderItem, // part of widget: GTK: treeview, and MWF: listview.details, datagrid and datagridview
52
		
53
		
53
		MainMenuBar,
54
		MainMenuBar,
54
		ParentMenu,
55
		ParentMenu,
(-)Test/UiaAtkBridgeTest/bridgetest.sh.in (-1 / +1 lines)
Lines 3-9 Link Here
3
DLL=UiaAtkBridgeTest.dll
3
DLL=UiaAtkBridgeTest.dll
4
4
5
TEST_DISPLAY=:1
5
TEST_DISPLAY=:1
6
NUNIT_FLAGS=-nothread
6
NUNIT_FLAGS=-nothread -noshadow
7
7
8
while getopts c:x o
8
while getopts c:x o
9
do case "$o" in
9
do case "$o" in
(-)UiaAtkBridge/TreeItem.cs (-13 lines)
Lines 108-126 Link Here
108
			return states;
108
			return states;
109
		}
109
		}
110
110
111
		protected override Atk.RelationSet OnRefRelationSet ()
112
		{
113
			Atk.RelationSet relSet = base.OnRefRelationSet ();
114
			IRawElementProviderFragment fragment = Provider as IRawElementProviderFragment;
115
			IRawElementProviderFragment parentProvider = fragment.Navigate (NavigateDirection.Parent);
116
			if (parentProvider != null) {
117
				Atk.Object parent = AutomationBridge.GetAdapterForProviderLazy (parentProvider);
118
				if (parent != null)
119
					relSet.AddRelationByType (Atk.RelationType.NodeChildOf, parent);
120
			}
121
			return relSet;
122
		}
123
124
		public string GetText (int startOffset, int endOffset)
111
		public string GetText (int startOffset, int endOffset)
125
		{
112
		{
126
			return textExpert.GetText (startOffset, endOffset);
113
			return textExpert.GetText (startOffset, endOffset);
(-)UiaAtkBridge/Adapter.cs (+39 lines)
Lines 212-217 Link Here
212
			return states;
212
			return states;
213
		}
213
		}
214
214
215
		protected override Atk.RelationSet OnRefRelationSet ()
216
		{
217
			Atk.RelationSet relationSet = base.OnRefRelationSet ();
218
219
			if (Role == Atk.Role.ScrollBar
220
			    || Role == Atk.Role.RadioButton)
221
				return relationSet;
222
			
223
			IRawElementProviderFragment fragment = Provider as IRawElementProviderFragment;
224
			IRawElementProviderFragment parentProvider = fragment.Navigate (NavigateDirection.Parent);
225
			
226
			if (parentProvider != null) {
227
				// To support NodeChildOf parent must be either
228
				// - DataGrid, Table or Group, or
229
				// - ListItem or DataItem, in this case the parent of parent is used,
230
				//   because we are ignoring this parent (either ListItem or DataItem).
231
				int controlType 
232
					= (int) parentProvider.GetPropertyValue (AutomationElementIdentifiers.ControlTypeProperty.Id);
233
				Atk.Object parentAdapter = null;
234
235
				if (controlType == ControlType.DataGrid.Id
236
				    || controlType == ControlType.Table.Id
237
				    || controlType == ControlType.Group.Id)
238
					parentAdapter = AutomationBridge.GetAdapterForProviderLazy (parentProvider);
239
				else if (controlType == ControlType.ListItem.Id
240
				         || controlType == ControlType.DataItem.Id) {
241
					parentProvider = parentProvider.Navigate (NavigateDirection.Parent);
242
					parentAdapter = AutomationBridge.GetAdapterForProviderLazy (parentProvider);					
243
				} else
244
					return relationSet;
245
				
246
				if (parentAdapter != null)
247
					relationSet.AddRelationByType (Atk.RelationType.NodeChildOf, 
248
					                               parentAdapter);
249
			}
250
251
			return relationSet;
252
		}		
253
215
		protected override int OnGetIndexInParent()
254
		protected override int OnGetIndexInParent()
216
		{
255
		{
217
			if (Parent == null)
256
			if (Parent == null)

Return to bug 479142