示例#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);
        }
示例#2
0
        public string [] GetVisibleRangePaths()
        {
            var           visibleRanges     = provider.GetVisibleRanges();
            List <string> visibleRangePaths = new List <string> (visibleRanges.Length);

            foreach (var visibleRange in visibleRanges)
            {
                visibleRangePaths.Add(GetOrCreateTextRange(visibleRange));
            }
            return(visibleRangePaths.ToArray());
        }