Bug 513057 - Text property of SWF controls is not visible if AccessibleName is gave
Summary: Text property of SWF controls is not visible if AccessibleName is gave
Status: REOPENED
Alias: None
Product: UI Automation
Classification: Mono
Component: Winforms - General (show other bugs)
Version: Release 1.0
Hardware: x86 openSUSE 11.1
: P3 - Medium : Normal
Target Milestone: ---
Assignee: E-mail List
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-15 03:29 UTC by calen chen
Modified: 2010-05-20 18:01 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
sample with AccessibleName and Text properties (4.60 KB, text/x-python)
2009-06-15 03:29 UTC, calen chen
Details
bug fix patch (5.54 KB, patch)
2009-07-07 09:31 UTC, Rui Guo
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description calen chen 2009-06-15 03:29:59 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
Comment 1 Rui Guo 2009-07-02 18:16:51 UTC
[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")
Comment 2 calen chen 2009-07-07 08:37:05 UTC
This bug is not only valid for button control, but also valid for controls which have Text property.
Comment 3 Rui Guo 2009-07-07 09:31:30 UTC
Created attachment 303386 [details]
bug fix patch

For reviewers: I used reflection APIs to implement "UIAWinformsTextPropertyTextImplementor", since I cannot refer UIAutomationWinforms in UiaAtkBridge.
Comment 4 Rui Guo 2009-07-07 09:32:03 UTC
Change status to "Fixed"
Comment 5 calen chen 2010-05-06 07:47:07 UTC
reopened the bug due to still appears in 2.0.3 version, are you sure the patch has been included? thanks!