Exemple #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;

        }