public void TextBoxBaseUiaTextProvider_RangeFromPoint_ReturnsNull_WithoutHandle(Point point) { using TextBoxBase textBoxBase = new SubTextBoxBase(); TextBoxBaseUiaTextProvider provider = new TextBoxBaseUiaTextProvider(textBoxBase); UiaTextRange textRangeProvider = provider.RangeFromPoint(point) as UiaTextRange; Assert.Null(textRangeProvider); Assert.False(textBoxBase.IsHandleCreated); }
public void TextBoxBaseUiaTextProvider_RangeFromPoint_DoesntThrowAnException(Point point) { using TextBoxBase textBoxBase = new SubTextBoxBase(); textBoxBase.CreateControl(); TextBoxBaseUiaTextProvider provider = new TextBoxBaseUiaTextProvider(textBoxBase); UiaTextRange textRangeProvider = provider.RangeFromPoint(point) as UiaTextRange; Assert.NotNull(textRangeProvider); Assert.True(textBoxBase.IsHandleCreated); }
public void TextBoxBaseUiaTextProvider_SetSelection_GetSelection_ReturnCorrectValue(int start, int end) { using TextBoxBase textBoxBase = new SubTextBoxBase(); textBoxBase.CreateControl(); textBoxBase.Text = "Some test text for testing"; TextBoxBaseUiaTextProvider provider = new TextBoxBaseUiaTextProvider(textBoxBase); provider.SetSelection(start, end); UiaCore.ITextRangeProvider[] selection = provider.GetSelection(); Assert.NotNull(selection); UiaTextRange textRange = selection[0] as UiaTextRange; Assert.NotNull(textRange); Assert.Equal(start, textRange.Start); Assert.Equal(end, textRange.End); Assert.True(textBoxBase.IsHandleCreated); }
public void TextBoxBaseUiaTextProvider_SetSelection_DoesntSelectText_IfIncorrectArguments(int start, int end) { using (new NoAssertContext()) { using TextBoxBase textBoxBase = new SubTextBoxBase(); textBoxBase.CreateControl(); textBoxBase.Text = "Some test text for testing"; TextBoxBaseUiaTextProvider provider = new TextBoxBaseUiaTextProvider(textBoxBase); provider.SetSelection(start, end); UiaCore.ITextRangeProvider[] selection = provider.GetSelection(); Assert.NotNull(selection); UiaTextRange textRange = selection[0] as UiaTextRange; Assert.NotNull(textRange); Assert.Equal(0, textRange.Start); Assert.Equal(0, textRange.End); Assert.True(textBoxBase.IsHandleCreated); } }