Inheritance: BasePattern
Example #1
0
        /// -------------------------------------------------------------------
        /// <summary></summary>
        /// -------------------------------------------------------------------
        internal ScrollItemPatternWrapper(AutomationElement element, string testSuite, TestPriorities priority, TypeOfControl typeOfControl, TypeOfPattern typeOfPattern, string dirResults, bool testEvents, IApplicationCommands commands)
            :
            base(element, testSuite, priority, typeOfControl, typeOfPattern, dirResults, testEvents, commands)
        {
            Comment("Creating ScrollItemTests");

            _pattern = (ScrollItemPattern)GetPattern(m_le, m_useCurrent, ScrollItemPattern.Pattern);
            if (_pattern == null)
                ThrowMe(CheckType.IncorrectElementConfiguration, Helpers.PatternNotSupported + ": ScrollItemPattern");

            // Find the ScrollPattern
            _container = m_le;

            while (_container != null && !(bool)_container.GetCurrentPropertyValue(AutomationElement.IsScrollPatternAvailableProperty))
                _container = TreeWalker.ControlViewWalker.GetParent(_container);

            // Check to see if we actual found the container of the scrollitem
            if (_container == null)
                ThrowMe(CheckType.IncorrectElementConfiguration, "Element does not have a container with ScrollPattern");

            Comment("Found scroll container: " + Library.GetUISpyLook(_container));

            _scrollPattern = (ScrollPattern)_container.GetCurrentPattern(ScrollPattern.Pattern) as ScrollPattern;

        }
Example #2
0
			internal ScrollPatternInformation (ScrollPattern pattern, bool cache)
			{
				this.pattern = pattern;
				this.cache = cache;
			}
Example #3
0
 protected WPFScrollBar(AutomationElement parent)
 {
     scrollPattern = (ScrollPattern) parent.GetCurrentPattern(ScrollPattern.Pattern);
 }
Example #4
0
		/// -------------------------------------------------------------------
		/// <summary></summary>
		/// -------------------------------------------------------------------
		internal ScrollPatternWrapper(AutomationElement element, string testSuite, TestPriorities priority, TypeOfControl typeOfControl, TypeOfPattern typeOfPattern, string dirResults, bool testEvents, IApplicationCommands commands)
            :
            base(element, testSuite, priority, typeOfControl, typeOfPattern, dirResults, testEvents, commands)
        {
            m_pattern = (ScrollPattern)GetPattern(m_le, m_useCurrent, ScrollPattern.Pattern);
        }
Example #5
0
 public ScrollPatternAxis(ScrollPattern scrollPattern, OrientationType orientation) {
     this.scrollPattern = scrollPattern;
     this.orientation = orientation;
 }
Example #6
0
		protected override void CustomFixtureSetUp ()
		{
			base.CustomFixtureSetUp ();
			scrollPattern = (ScrollPattern)
				listView1Element.GetCurrentPattern (ScrollPattern.Pattern);
			listItem0Element = FindItem ("Item 0");
			listItem9Element = FindItem ("Item 9");
		}
Example #7
0
        private void ScrollIntoView(IElement container, ScrollPattern scrollbar, bool horizontally, bool incrementally)
        {
            // TODO To make scrolling more efficient, make big steps in the beginning.
            var step = incrementally ? ScrollAmount.SmallIncrement : ScrollAmount.SmallDecrement;

            bool done = false;
            do
            {
                // dimensions of partially displayed elements only reveal visible parts. (XAML-based only)
                int before = horizontally ? this.Width : this.Height;
                if (horizontally)
                {
                    scrollbar.Scroll(step, ScrollAmount.NoAmount);
                }
                else
                {
                    scrollbar.Scroll(ScrollAmount.NoAmount, step);
                }

                System.Threading.Thread.Sleep(20); // or the following readings could be stale
                this.ResetCache();
                int after = horizontally ? this.Width : this.Height;

                if (horizontally)
                {
                    if (incrementally)
                    {
                        done = this.X + this.Width <= container.X + container.Width;
                    }
                    else
                    {
                        done = this.X >= container.X;
                    }
                }
                else
                {
                    if (incrementally)
                    {
                        done = this.Y + this.Height <= container.Y + container.Height;
                    }
                    else
                    {
                        done = this.Y >= container.Y;
                    }
                }

                done = done && (after <= before); // leaving the element

                logger.Debug(
                    "Done? {0}; element [{1},{2}][{3},{4}] in the scrollable container [{5},{6}][{7},{8}]",
                    done, this.X, this.Y, this.Width, this.Height, container.X, container.Y, container.Width, container.Height);
            }
            while (!done);
        }
Example #8
0
 internal ScrollPatternInformation(ScrollPattern pattern, bool cache)
 {
     this.pattern = pattern;
     this.cache   = cache;
 }