Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
In UIAutomation/:
Browse files Browse the repository at this point in the history
	* UIAutomationClientTests/UIAutomationClientTests/AutomationElementTest.cs: unit tests for bug#570621 and bug#571711

In UIAutomationWinforms/:
	* UIAutomationWinforms/Mono.UIAutomation.Winforms/ComboBoxProvider.cs:
	* UIAutomationWinforms/Mono.UIAutomation.Winforms/DataGridProvider.cs:
	* UIAutomationWinforms/Mono.UIAutomation.Winforms/ListItemProvider.cs:
	* UIAutomationWinforms/Mono.UIAutomation.Winforms/ScrollBarProvider.cs:
	* UIAutomationWinforms/Mono.UIAutomation.Winforms/DataGridViewProvider.cs:
	* UIAutomationWinforms/Mono.UIAutomation.Winforms/PropertyGridViewProvider.cs:
	* UIAutomationWinforms/Mono.UIAutomation.Winforms/MonthCalendarDataGridProvider.cs:
	* UIAutomationWinforms/Mono.UIAutomation.Winforms/MonthCalendarListItemProvider.cs:
	* UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/DataGrid/DataItemValueProviderBehavior.cs:
	* UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/DomainUpDown/ListItemValueProviderBehavior.cs: Fix bug#570621 and bug#571711

In UiaDbus/:
	* UiaDbusBridge/AutomationBridge.cs: Fix bug#570621

svn path=/trunk/uia2atk/; revision=149891
  • Loading branch information
Matt Guo committed Jan 20, 2010
1 parent fcc7f0f commit eb6936a
Show file tree
Hide file tree
Showing 15 changed files with 91 additions and 5 deletions.
4 changes: 4 additions & 0 deletions UIAutomation/ChangeLog
@@ -1,3 +1,7 @@
2010-01-20 Matt Guo <matt@mattguo.com>

* UIAutomationClientTests/UIAutomationClientTests/AutomationElementTest.cs: unit tests for bug#570621 and bug#571711

2010-01-14 Matt Guo <matt@mattguo.com>

* UIAutomationSource/Mono.UIAutomation.Source/IElement.cs:
Expand Down
Expand Up @@ -1123,6 +1123,27 @@ public void SupportedPropertiesTest ()
SupportedPropertiesTestInternal (treeView1Element);
SupportedPropertiesTestInternal (listView1Element);
}

[Test]
public void Bug570621_Test ()
{
var firstDataItem = this.table1Element.FindFirst (TreeScope.Children, new PropertyCondition(
AEIds.ControlTypeProperty, ControlType.DataItem));
Assert.AreEqual (0, firstDataItem.Current.NativeWindowHandle);

Assert.AreEqual (table1Element,
AutomationElement.FromHandle (new IntPtr (table1Element.Current.NativeWindowHandle)));
}

[Test]
public void Bug571711_Test ()
{
var firstDataItem = this.table1Element.FindFirst (TreeScope.Children, new PropertyCondition(
AEIds.ControlTypeProperty, ControlType.DataItem));
//assert the following line won't fire any exception
firstDataItem.GetCurrentPropertyValue (ValuePattern.ValueProperty);
}

#endregion

#region Private Methods
Expand Down
13 changes: 13 additions & 0 deletions UIAutomationWinforms/ChangeLog
@@ -1,3 +1,16 @@
2010-01-20 Matt Guo <matt@mattguo.com>

* UIAutomationWinforms/Mono.UIAutomation.Winforms/ComboBoxProvider.cs:
* UIAutomationWinforms/Mono.UIAutomation.Winforms/DataGridProvider.cs:
* UIAutomationWinforms/Mono.UIAutomation.Winforms/ListItemProvider.cs:
* UIAutomationWinforms/Mono.UIAutomation.Winforms/ScrollBarProvider.cs:
* UIAutomationWinforms/Mono.UIAutomation.Winforms/DataGridViewProvider.cs:
* UIAutomationWinforms/Mono.UIAutomation.Winforms/PropertyGridViewProvider.cs:
* UIAutomationWinforms/Mono.UIAutomation.Winforms/MonthCalendarDataGridProvider.cs:
* UIAutomationWinforms/Mono.UIAutomation.Winforms/MonthCalendarListItemProvider.cs:
* UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/DataGrid/DataItemValueProviderBehavior.cs:
* UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/DomainUpDown/ListItemValueProviderBehavior.cs: Fix bug#570621 and bug#571711

2010-01-14 Matt Guo <matt@mattguo.com>

* UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/TableProviderBehavior.cs:
Expand Down
Expand Up @@ -96,7 +96,7 @@ public void SetValue (string value)
}

public string Value {
get { return provider.Value as string; }
get { return provider.Value as string ?? string.Empty; }
}

#endregion
Expand Down
Expand Up @@ -88,7 +88,10 @@ public void SetValue (string value)
}

public string Value {
get { return Convert.ToString (((ListItemProvider)Provider).ObjectItem); }
get {
var val = Convert.ToString (((ListItemProvider)Provider).ObjectItem);
return val ?? string.Empty;
}
}
#endregion

Expand Down
Expand Up @@ -305,7 +305,11 @@ protected override object GetProviderPropertyValue (int propertyId)
IExpandCollapseProvider pattern
= comboboxProvider.GetPatternProvider (ExpandCollapsePatternIdentifiers.Pattern.Id) as IExpandCollapseProvider;
return pattern != null && pattern.ExpandCollapseState == ExpandCollapseState.Collapsed;
} else
} else if (propertyId == AutomationElementIdentifiers.NativeWindowHandleProperty.Id)
//Not like Windows, ComboBox.ListBox is a "real control" and has its own handle.
//On mono ComboxBox.ListBox dosen't has native window handle.
return null;
else
return base.GetProviderPropertyValue (propertyId);
}

Expand Down Expand Up @@ -562,6 +566,8 @@ protected override object GetProviderPropertyValue (int propertyId)
return Catalog.GetString ("Drop Down Button");
else if (propertyId == AutomationElementIdentifiers.LabeledByProperty.Id)
return null;
else if (propertyId == AutomationElementIdentifiers.NativeWindowHandleProperty.Id)
return null;
else
return base.GetProviderPropertyValue (propertyId);
}
Expand Down
Expand Up @@ -786,6 +786,8 @@ protected override object GetProviderPropertyValue (int propertyId)
(Rect) GetPropertyValue (AutomationElementIdentifiers.BoundingRectangleProperty.Id));
} else if (propertyId == AutomationElementIdentifiers.ClickablePointProperty.Id)
return Helper.GetClickablePoint (this);
else if (propertyId == AutomationElementIdentifiers.NativeWindowHandleProperty.Id)
return null;
else
return base.GetProviderPropertyValue (propertyId);
}
Expand Down
Expand Up @@ -540,6 +540,8 @@ protected override object GetProviderPropertyValue (int propertyId)
return ControlType.DataItem.Id;
else if (propertyId == AutomationElementIdentifiers.LocalizedControlTypeProperty.Id)
return Catalog.GetString ("data item");
else if (propertyId == AutomationElementIdentifiers.NativeWindowHandleProperty.Id)
return null;
else
return base.GetProviderPropertyValue (propertyId);
}
Expand Down
Expand Up @@ -95,6 +95,8 @@ protected override object GetProviderPropertyValue (int propertyId)
|| propertyId == AutomationElementIdentifiers.NameProperty.Id
|| propertyId == AutomationElementIdentifiers.IsOffscreenProperty.Id)
return ListProvider.GetItemPropertyValue (this, propertyId);
else if (propertyId == AutomationElementIdentifiers.NativeWindowHandleProperty.Id)
return null;
else
return base.GetProviderPropertyValue (propertyId);
}
Expand Down
Expand Up @@ -75,6 +75,8 @@ protected override object GetProviderPropertyValue (int propertyId)
return ControlType.DataGrid.Id;
else if (propertyId == AEIds.LocalizedControlTypeProperty.Id)
return Catalog.GetString ("data grid");
else if (propertyId == AEIds.NativeWindowHandleProperty.Id)
return null;

return base.GetProviderPropertyValue (propertyId);
}
Expand Down Expand Up @@ -392,6 +394,8 @@ protected override object GetProviderPropertyValue (int propertyId)
return false;
else if (propertyId == AEIds.LabeledByProperty.Id)
return null;
else if (propertyId == AEIds.NativeWindowHandleProperty.Id)
return null;

return base.GetProviderPropertyValue (propertyId);
}
Expand Down Expand Up @@ -463,6 +467,8 @@ protected override object GetProviderPropertyValue (int propertyId)
return label;
else if (propertyId == AEIds.LabeledByProperty.Id)
return null;
else if (propertyId == AEIds.NativeWindowHandleProperty.Id)
return null;

return base.GetProviderPropertyValue (propertyId);
}
Expand Down Expand Up @@ -521,6 +527,8 @@ protected override object GetProviderPropertyValue (int propertyId)
}
} else if (propertyId == AEIds.LabeledByProperty.Id)
return null;
else if (propertyId == AEIds.NativeWindowHandleProperty.Id)
return null;

return base.GetProviderPropertyValue (propertyId);
}
Expand Down
Expand Up @@ -120,6 +120,8 @@ protected override object GetProviderPropertyValue (int propertyId)
return Catalog.GetString ("list item");
else if (propertyId == AEIds.NameProperty.Id)
return Text;
else if (propertyId == AEIds.NativeWindowHandleProperty.Id)
return null;

return base.GetProviderPropertyValue (propertyId);
}
Expand Down Expand Up @@ -161,6 +163,8 @@ protected override object GetProviderPropertyValue (int propertyId)
return Catalog.GetString ("edit");
else if (propertyId == AEIds.NameProperty.Id)
return listItemProvider.Text;
else if (propertyId == AEIds.NativeWindowHandleProperty.Id)
return null;

return base.GetProviderPropertyValue (propertyId);
}
Expand Down
Expand Up @@ -380,6 +380,8 @@ protected override object GetProviderPropertyValue (int propertyId)
return ControlType.DataItem.Id;
else if (propertyId == AEIds.LocalizedControlTypeProperty.Id)
return Catalog.GetString ("data item");
else if (propertyId == AEIds.NativeWindowHandleProperty.Id)
return null;
else
return base.GetProviderPropertyValue (propertyId);
}
Expand Down Expand Up @@ -433,6 +435,8 @@ protected override object GetProviderPropertyValue (int propertyId)
controlRect.X = controlRect.Y = 0;
return !controlRect.IntersectsWith (GetBounds ());
}
else if (propertyId == AEIds.NativeWindowHandleProperty.Id)
return null;

return base.GetProviderPropertyValue (propertyId);
}
Expand Down Expand Up @@ -592,6 +596,8 @@ protected override object GetProviderPropertyValue (int propertyId)
{
if (propertyId == AEIds.NameProperty.Id)
return entry.Label;
else if (propertyId == AEIds.NativeWindowHandleProperty.Id)
return null;
else if (propertyId == AEIds.ControlTypeProperty.Id)
return ControlType.Custom.Id;

Expand Down
Expand Up @@ -23,7 +23,7 @@
// Mario Carrion <mcarrion@novell.com>
//
using System;
using System.Drawing;
using System.Drawing;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Automation.Provider;
Expand Down Expand Up @@ -263,6 +263,8 @@ protected override object GetProviderPropertyValue (int propertyId)
return false;
else if (propertyId == AutomationElementIdentifiers.ControlTypeProperty.Id)
return ControlType.Button.Id;
else if (propertyId == AutomationElementIdentifiers.NativeWindowHandleProperty.Id)
return null;
else
return base.GetProviderPropertyValue (propertyId);
}
Expand Down Expand Up @@ -319,6 +321,8 @@ protected override object GetProviderPropertyValue (int propertyId)
return Catalog.GetString ("thumb");
else if (propertyId == AutomationElementIdentifiers.IsContentElementProperty.Id)
return false;
else if (propertyId == AutomationElementIdentifiers.NativeWindowHandleProperty.Id)
return null;
else
return base.GetProviderPropertyValue (propertyId);
}
Expand Down
4 changes: 4 additions & 0 deletions UiaDbus/ChangeLog
@@ -1,3 +1,7 @@
2010-01-20 Matt Guo <matt@mattguo.com>

* UiaDbusBridge/AutomationBridge.cs: Fix bug#570621

2010-01-14 Matt Guo <matt@mattguo.com>

* UiaDbusSource/UiaDbusElement.cs:
Expand Down
9 changes: 8 additions & 1 deletion UiaDbus/UiaDbusBridge/AutomationBridge.cs
Expand Up @@ -196,8 +196,15 @@ public void RaiseStructureChangedEvent (object provider, StructureChangedEventAr
lock (providerWrapperMapping)
providerWrapperMapping [simpleProvider] = element;
if (providerHandle != IntPtr.Zero)
lock (pointerProviderMapping)
lock (pointerProviderMapping) {
// TODO Add debug flag here, we'd better remove the ContainsKey check in the release version
if (pointerProviderMapping.ContainsKey (providerHandle)) {
Log.Error ("Duplicate provider handle, {0}, {1}",
simpleProvider.GetPropertyValue (AEIds.NameProperty.Id),
simpleProvider.GetPropertyValue (AEIds.LocalizedControlTypeProperty.Id));
}
pointerProviderMapping [providerHandle] = simpleProvider;
}
if (isWindow)
app.AddRootElement (element);

Expand Down

0 comments on commit eb6936a

Please sign in to comment.