public void TextBoxBaseUiaTextProvider_GetPositionFromCharForUpperRightCorner_ReturnsMinusOne_WithoutHandle(Size size, string text, bool multiline, int charIndex, Point expectedPoint) { using SubTextBoxBase textBoxBase = new SubTextBoxBase() { Size = size, Text = text, Multiline = multiline }; TextBoxBaseUiaTextProvider provider = new TextBoxBaseUiaTextProvider(textBoxBase); Point actualPoint = provider.GetPositionFromCharForUpperRightCorner(charIndex, textBoxBase.Text); Assert.Equal(Point.Empty, actualPoint); Assert.False(textBoxBase.IsHandleCreated); }
public void TextBoxBaseUiaTextProvider_GetPositionFromCharForUpperRightCorner_ReturnsCorrectValue(Size size, string text, bool multiline, int charIndex, Point expectedPoint) { using SubTextBoxBase textBoxBase = new SubTextBoxBase() { Size = size, Text = text, Multiline = multiline }; textBoxBase.CreateControl(); TextBoxBaseUiaTextProvider provider = new TextBoxBaseUiaTextProvider(textBoxBase); Point actualPoint = provider.GetPositionFromCharForUpperRightCorner(charIndex, textBoxBase.Text); Assert.True(actualPoint.X >= expectedPoint.X - 1 || actualPoint.X <= expectedPoint.X + 1); Assert.True(actualPoint.Y >= expectedPoint.Y - 1 || actualPoint.Y <= expectedPoint.Y + 1); Assert.True(textBoxBase.IsHandleCreated); }