Utilities used by TextPattern testing both within UIA Verify and without
示例#1
0
        public static void CountTextUnitsInRange(TextPatternRange rangeToCount, TextUnit[] supportedTextUnits, ref int[] numberOfTextUnits)
        {
            // Validate arrays
            if (supportedTextUnits.Length != (((int)TextUnit.Document) + 1))
            {
                throw new ArgumentException("supportedTextUnits array is of incorrect length");
            }

            if (numberOfTextUnits.Length != (((int)TextUnit.Document) + 1))
            {
                throw new ArgumentException("numberOfTextUnits array is of incorrect length");
            }

            // Determine supported text units
            numberOfTextUnits[(int)TextUnit.Character] = TextLibraryCount.CountTextUnit(TextUnit.Character, rangeToCount);
            numberOfTextUnits[(int)TextUnit.Format]    = TextLibraryCount.CountTextUnit(TextUnit.Format, rangeToCount);
            numberOfTextUnits[(int)TextUnit.Word]      = TextLibraryCount.CountTextUnit(TextUnit.Word, rangeToCount);
            numberOfTextUnits[(int)TextUnit.Line]      = TextLibraryCount.CountTextUnit(TextUnit.Line, rangeToCount);
            numberOfTextUnits[(int)TextUnit.Paragraph] = TextLibraryCount.CountTextUnit(TextUnit.Paragraph, rangeToCount);
            numberOfTextUnits[(int)TextUnit.Page]      = TextLibraryCount.CountTextUnit(TextUnit.Page, rangeToCount);
            numberOfTextUnits[(int)TextUnit.Document]  = TextLibraryCount.CountTextUnit(TextUnit.Document, rangeToCount);
        }
示例#2
0
 ///---------------------------------------------------------------------------
 /// <summary>
 /// Gets ClassName and LocalizedControlType properties
 /// </summary>
 ///---------------------------------------------------------------------------
 public static void GetClassName(AutomationElement autoElement, out string className, out string localizedControlType)
 {
     TextLibraryCount.GetClassName(autoElement, out className, out localizedControlType);
 }
示例#3
0
 //-------------------------------------------------------------------
 // Identify supported TextUnits in Win32
 //-------------------------------------------------------------------
 internal static TextUnit win32_IdentifySupportedTextUnits(AutomationElement element, TextUnit targetUnit)
 {
     return(TextLibraryCount.win32_IdentifySupportedTextUnits(element, targetUnit));
 }
示例#4
0
 /// ---------------------------------------------------------------------------
 /// <summary>
 /// Identify if we're on RichEdit control or not
 /// </summary>
 /// ---------------------------------------------------------------------------
 public static bool IsRichEdit(AutomationElement autoElement)
 {
     return(TextLibraryCount.IsRichEdit(autoElement));
 }
示例#5
0
 /// -------------------------------------------------------------------
 /// <summary>
 /// Identifies supported text units. Some units will map upwards
 /// TextUnit.Page, for example, maps up to a Document for all
 /// controls/providers except Word/Office
 /// </summary>
 /// -------------------------------------------------------------------
 public static void IdentifySupportedTextUnits(AutomationElement element, ref TextUnit[] supportedTextUnits)
 {
     TextLibraryCount.IdentifySupportedTextUnits(element, ref supportedTextUnits);
 }
示例#6
0
 /// -------------------------------------------------------------------
 /// <summary>
 /// Count # of LF within a TextPatternRange (provide agnostic... for now)
 /// </summary>
 /// -------------------------------------------------------------------
 public static int CountParagraphs(string actualText)
 {
     return(TextLibraryCount.CountParagraphs(actualText));
 }
示例#7
0
 /// -------------------------------------------------------------------
 /// Count # of lines within a TextPatternRange (win32 specific)
 /// -------------------------------------------------------------------
 public static int Win32CountLines(AutomationElement element)
 {
     return(TextLibraryCount.Win32CountLines(element));
 }
示例#8
0
 public static int CountTextUnit(TextUnit tu, TextPatternRange rangeToCount)
 {
     return(TextLibraryCount.CountTextUnit(tu, rangeToCount));
 }
示例#9
0
 ///---------------------------------------------------------------------------
 /// <summary>
 /// Gets ClassName property
 /// </summary>
 ///---------------------------------------------------------------------------
 public static string GetClassName(AutomationElement autoElement)
 {
     return(TextLibraryCount.GetClassName(autoElement));
 }