Bugzilla – Bug 513057
Text property of SWF controls is not visible if AccessibleName is gave
Last modified: 2010-05-20 18:01:05 UTC
Created attachment 298006 [details] sample with AccessibleName and Text properties PROBLEM STATEMENT In attachment sample, I gave self.button1.AccessibleName and self.button1.Text properties with different string. but ATs got AccesibleName as button1's Name and Text, that is mean self.button1.Text property is not used self.button1.AccessibleName = "Button1_AccessibleName" self.button1.Text = "button1" REPRO 1. Open Accerciser and click on the "Interface Viewer" tab 2. Run the attachment sample, the first button shows "button1" on the GUI 3. Browse to the first 'push button' on the left treeview, it's name shows "Button1_AccessibleName" 4. under 'interface viewer', expand 'Text', Observe the Text of button1 RESULTS in step4, Text shows "Button1_AccessibleName", but not "button1" EXPECTED RESULTS I think Text shouldn't be implemented to AccessibleName in here because Text property is gave alone. COMMENTS
[Root Cause] In UiaAtkBridge/Button.cs, public string GetText (int startOffset, int endOffset) { return textExpert.GetText (startOffset, endOffset); } Where textExpert is instantiated with: textExpert = TextImplementorFactory.GetImplementor (this, provider); And in TextImplementorFactory.GetImplementor (UiaAtkBridge/TextImplementorFactory.cs): public static ITextImplementor GetImplementor (Adapter adapter, IRawElementProviderSimple prov) { ITextProvider textProvider = prov.GetPatternProvider (TextPatternIdentifiers.Pattern.Id) as ITextProvider; if (textProvider != null) return new TextProviderTextImplementor (adapter, textProvider); IValueProvider valueProvider = prov.GetPatternProvider (ValuePatternIdentifiers.Pattern.Id) as IValueProvider; if (valueProvider != null) return new ValueProviderTextImplementor (adapter, valueProvider); IRangeValueProvider rangeValueProvider = prov.GetPatternProvider (RangeValuePatternIdentifiers.Pattern.Id) as IRangeValueProvider; if (rangeValueProvider != null) return new RangeValueProviderTextImplementor (adapter, rangeValueProvider); return new NamePropertyTextImplementor (adapter, prov); } Since Button is not any of the "TextPattern", "ValuePattern", "RangeValuePattern", it will finally use the "NamePropertyTextImplementor", and its NameProperty would be its AccessibleName. [Suggestion] Implement a new ITextImplementor named TextPropTextImplementor, which get the target control object's Text property and return it as the Atk.Text, then we make Button to use such TextPropTextImplementor (instead of the "NamePropertyTextImplementor")
This bug is not only valid for button control, but also valid for controls which have Text property.
Created attachment 303386 [details] bug fix patch For reviewers: I used reflection APIs to implement "UIAWinformsTextPropertyTextImplementor", since I cannot refer UIAutomationWinforms in UiaAtkBridge.
Change status to "Fixed"
reopened the bug due to still appears in 2.0.3 version, are you sure the patch has been included? thanks!