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

(-)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/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/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/ContextMenu.cs (-3 / +1 lines)
Lines 60-67 Link Here
60
			AutomationBridge.HandleTotalElementRemoval (this.Provider);
60
			AutomationBridge.HandleTotalElementRemoval (this.Provider);
61
		}
61
		}
62
62
63
		internal Adapter VirtualParent {
63
64
			get { return AutomationBridge.GetParentAdapter (Provider); }
65
		}
66
	}
64
	}
67
}
65
}
(-)UiaAtkBridge/Adapter.cs (+37 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
			Adapter parentAdapter = VirtualParent;
224
			if (parentAdapter != null) {
225
				// To support NodeChildOf parent must be either
226
				// - DataGrid, Table or Group, or
227
				// - ListItem or DataItem, in this case the parent of parent is used,
228
				//   because we are ignoring this parent (either ListItem or DataItem).
229
				int controlType 
230
					= (int) parentAdapter.Provider.GetPropertyValue (AutomationElementIdentifiers.ControlTypeProperty.Id);
231
232
				if (controlType == ControlType.ListItem.Id
233
				    || controlType == ControlType.DataItem.Id)
234
					parentAdapter = parentAdapter.VirtualParent;
235
				else if (controlType != ControlType.DataGrid.Id
236
				         && controlType != ControlType.Table.Id
237
				         && controlType != ControlType.Group.Id)
238
					return relationSet;
239
				
240
				if (parentAdapter != null)
241
					relationSet.AddRelationByType (Atk.RelationType.NodeChildOf, 
242
					                               parentAdapter);
243
			}
244
245
			return relationSet;
246
		}
247
215
		protected override int OnGetIndexInParent()
248
		protected override int OnGetIndexInParent()
216
		{
249
		{
217
			if (Parent == null)
250
			if (Parent == null)
Lines 258-263 Link Here
258
			}
291
			}
259
		}
292
		}
260
293
294
		internal Adapter VirtualParent {
295
			get { return AutomationBridge.GetParentAdapter (Provider); }
296
		}		
297
261
		private void EmitBoundsChanged (System.Windows.Rect rect)
298
		private void EmitBoundsChanged (System.Windows.Rect rect)
262
		{
299
		{
263
			Atk.Rectangle atkRect;
300
			Atk.Rectangle atkRect;

Return to bug 479142