ITextRangeProvider ITextRangeProvider.FindAttribute(int attributeId, object val, bool backwards) { AutomationTextAttribute attribute = AutomationTextAttribute.LookupById(attributeId); // generic controls are plain text so if the attribute matches then it matches over the whole range. // To workaround the conversion that Marshaling of COM-interop did. object targetAttribute = GetAttributeValue(attribute); if (targetAttribute is Enum) { targetAttribute = (int)targetAttribute; } return(val.Equals(targetAttribute) ? new WindowsEditBoxRange(_provider, Start, End) : null); }
public void BackgroundColorAttributeTest() { AutomationTextAttribute myBackgroundColorAttribute = TextPatternIdentifiers.BackgroundColorAttribute; Assert.IsNotNull( myBackgroundColorAttribute, "Field must not be null."); Assert.AreEqual( 40001, myBackgroundColorAttribute.Id, "Id"); Assert.AreEqual( "TextPatternIdentifiers.BackgroundColorAttribute", myBackgroundColorAttribute.ProgrammaticName, "ProgrammaticName"); Assert.AreEqual( myBackgroundColorAttribute, AutomationTextAttribute.LookupById(myBackgroundColorAttribute.Id), "LookupById"); }
public void UnderlineStyleAttributeTest() { AutomationTextAttribute myUnderlineStyleAttribute = TextPatternIdentifiers.UnderlineStyleAttribute; Assert.IsNotNull( myUnderlineStyleAttribute, "Field must not be null."); Assert.AreEqual( 40030, myUnderlineStyleAttribute.Id, "Id"); Assert.AreEqual( "TextPatternIdentifiers.UnderlineStyleAttribute", myUnderlineStyleAttribute.ProgrammaticName, "ProgrammaticName"); Assert.AreEqual( myUnderlineStyleAttribute, AutomationTextAttribute.LookupById(myUnderlineStyleAttribute.Id), "LookupById"); }
public void TextFlowDirectionsAttributeTest() { AutomationTextAttribute myTextFlowDirectionsAttribute = TextPatternIdentifiers.TextFlowDirectionsAttribute; Assert.IsNotNull( myTextFlowDirectionsAttribute, "Field must not be null."); Assert.AreEqual( 40028, myTextFlowDirectionsAttribute.Id, "Id"); Assert.AreEqual( "TextPatternIdentifiers.TextFlowDirectionsAttribute", myTextFlowDirectionsAttribute.ProgrammaticName, "ProgrammaticName"); Assert.AreEqual( myTextFlowDirectionsAttribute, AutomationTextAttribute.LookupById(myTextFlowDirectionsAttribute.Id), "LookupById"); }
public void MarginTrailingAttributeTest() { AutomationTextAttribute myMarginTrailingAttribute = TextPatternIdentifiers.MarginTrailingAttribute; Assert.IsNotNull( myMarginTrailingAttribute, "Field must not be null."); Assert.AreEqual( 40021, myMarginTrailingAttribute.Id, "Id"); Assert.AreEqual( "TextPatternIdentifiers.MarginTrailingAttribute", myMarginTrailingAttribute.ProgrammaticName, "ProgrammaticName"); Assert.AreEqual( myMarginTrailingAttribute, AutomationTextAttribute.LookupById(myMarginTrailingAttribute.Id), "LookupById"); }
public void HorizontalTextAlignmentAttributeTest() { AutomationTextAttribute myHorizontalTextAlignmentAttribute = TextPatternIdentifiers.HorizontalTextAlignmentAttribute; Assert.IsNotNull( myHorizontalTextAlignmentAttribute, "Field must not be null."); Assert.AreEqual( 40009, myHorizontalTextAlignmentAttribute.Id, "Id"); Assert.AreEqual( "TextPatternIdentifiers.HorizontalTextAlignmentAttribute", myHorizontalTextAlignmentAttribute.ProgrammaticName, "ProgrammaticName"); Assert.AreEqual( myHorizontalTextAlignmentAttribute, AutomationTextAttribute.LookupById(myHorizontalTextAlignmentAttribute.Id), "LookupById"); }
object ITextRangeProvider.GetAttributeValue(int attributeId) { AutomationTextAttribute attribute = AutomationTextAttribute.LookupById(attributeId); return(GetAttributeValue(attribute)); }
public object GetAttributeValue(int attribute) { return(GetAttributeValue(AutomationTextAttribute.LookupById(attribute))); }