//--------------------------------------------------------------------------- // Helper for GetVisibleRange() test cases // NOTE: This method assumes only a single range is selected, and will // not work correctly if multiple selections have taken place // Win32/DUI/Avalon do not support multiple selection. //--------------------------------------------------------------------------- internal void GetVisibleRangesHelper(SampleText sampleText, bool isMultiLineExpected, SupportedTextSelection supportedTextSelection, uint arrayCount) { string expectedText = ""; string actualText = ""; TextPatternRange[] visibleRanges = null; // Pre-Condition Control must supports multi-line = <<expectedResult>> TS_IsMultiLine(isMultiLineExpected, CheckType.IncorrectElementConfiguration); // Pre-Condition Verify text is expected value <<sampleText>> TS_SetText(sampleText, out expectedText, CheckType.IncorrectElementConfiguration); // Call GetVisibleRange on the control with no errors TS_GetVisibleRanges(ref visibleRanges, null, CheckType.Verification); // Call GetText() on FIRST visible range (post V1, this should validate against each/all ranges) TS_GetText(visibleRanges[0], ref actualText, -1, null, CheckType.Verification); // Verify that text range matches what was set in the control TS_TextWithin("GetVisibleRange()", actualText, expectedText, CheckType.Verification); }
//--------------------------------------------------------------------------- // Verifies the value of SupportedTextSelection //--------------------------------------------------------------------------- internal void TS_VerifySupportedTextSelection(SupportedTextSelection expectedValue, CheckType checkType) { SupportedTextSelection actualValue = TextLibrary.ProviderSupportedTextSelection();; // Compare what TextPattern tells us against what we expect based on the // test application says we should support if ( expectedValue != actualValue ) { Comment("TextPattern says SupportedTextSelection = " + actualValue.ToString()); Comment("Expected value to be = " + expectedValue.ToString()); ThrowMe(checkType, "Inconsistent expectedValue for SupportedTextSelection"); } Comment("SupportedTextSelection = " + actualValue + ", as expected"); m_TestStep++; }
//--------------------------------------------------------------------------- // Helper for GetSelection() test cases //--------------------------------------------------------------------------- internal void GetSelectionHelper(SampleText sampleText, SupportedTextSelection supportedTextSelection, TargetRangeType rangeType, bool expectMatch, uint arrayCount, Type expectedException) { bool isEqual = false; string actualText = ""; TextPatternRange callingRange = null; TextPatternRange[] selectedRange = null; // Pre-Condition Verify SupportedTextSelection=<<supportedTextSelection>> TS_VerifySupportedTextSelection(supportedTextSelection, CheckType.IncorrectElementConfiguration); // Pre-Condition Verify text is expected value <<sampleText>> TS_SetText(sampleText, out actualText, CheckType.IncorrectElementConfiguration); // Pre-Condition Create calling range=<<rangeType>> TS_CreateRange(out callingRange, rangeType, null, false, CheckType.Verification); // Call Select() TS_Select(callingRange, null, CheckType.Verification); // Call GetSelection() on calling range TS_GetSelection(ref selectedRange, arrayCount, expectedException, CheckType.Verification); // Compare selected range and calling range, comparison should = <<expectMatch>> TS_Compare(callingRange, selectedRange[0], ref isEqual, expectMatch, null, CheckType.Verification); }
//--------------------------------------------------------------------------- // TestStep for TextPattern.SupportedTextSelection Property //--------------------------------------------------------------------------- internal void TS_SupportedTextSelection(ref SupportedTextSelection supportedTextSelection) { Pattern_SupportedTextSelection(ref supportedTextSelection); m_TestStep++; }
public static UIAutomationClient.SupportedTextSelection Convert( SupportedTextSelection supportedTextSelection) { return((UIAutomationClient.SupportedTextSelection)supportedTextSelection); }
//--------------------------------------------------------------------------- // Wrapper for TextPattern.SupportedTextSelection Property //--------------------------------------------------------------------------- internal void Pattern_SupportedTextSelection(ref SupportedTextSelection supportedTextSelection) { string call = "TextPattern.SupportedTextSelection"; Comment("---Getting value of " + call); supportedTextSelection = _pattern.SupportedTextSelection; }