Exemplo n.º 1
0
        public void TextPatternTest()
        {
            T textBoxBase;
            IRawElementProviderSimple provider;

            GetProviderAndControl(out provider, out textBoxBase);

            ITextProvider textProvider
                = provider.GetPatternProvider(TextPatternIdentifiers.Pattern.Id)
                  as ITextProvider;

            Assert.IsNotNull(textProvider, "Not returning TextPatternIdentifiers.");
            Assert.IsTrue(textProvider is ITextProvider, "Not returning TextPatternIdentifiers.");

            textBoxBase.Text      = "abc123";
            textBoxBase.Multiline = true;

            ITextRangeProvider range = textProvider.RangeFromPoint(new Point(0, 0));

            Assert.IsNotNull(range);

            // should always return a degenerate range
            Assert.AreEqual(String.Empty, range.GetText(-1));

            // TODO: Actually check the value, instead of just
            // making sure it doesn't crash
            range.MoveEndpointByUnit(TextPatternRangeEndpoint.End, TextUnit.Character, 1);

            // TODO: Actually check the value, instead of just
            // making sure it doesn't crash
            ITextRangeProvider[] ranges = textProvider.GetVisibleRanges();
            Assert.AreEqual(1, ranges.Length);
        }
Exemplo n.º 2
0
 public string GetText(int maxLength)
 {
     return(provider.GetText(maxLength));
 }