Ejemplo n.º 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;

        }
Ejemplo n.º 2
0
 /// -------------------------------------------------------------------
 /// <summary></summary>
 /// -------------------------------------------------------------------
 internal InvokePatternWrapper(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("Calling GetPattern(InvokePattern) on " + Library.GetUISpyLook(element));
     m_pattern = (InvokePattern)GetPattern(m_le, m_useCurrent, InvokePattern.Pattern);
 }
Ejemplo n.º 3
0
        /// -------------------------------------------------------------------
        /// <summary></summary>
        /// -------------------------------------------------------------------
        protected TogglePatternWrapper(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)
        {
            _pattern = (TogglePattern)element.GetCurrentPattern(TogglePattern.Pattern);

            if (_pattern == null)
                throw new Exception("TogglePattern: " + Helpers.PatternNotSupported);
        }
Ejemplo n.º 4
0
        bool _Contiguous; //calendar only accept contigious selection

        /// -------------------------------------------------------------------
        /// <summary></summary>
        /// -------------------------------------------------------------------
        internal SelectionPatternWrapper(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)
        {
            _pattern = (SelectionPattern)GetPattern(m_le, m_useCurrent, SelectionPattern.Pattern);

            ControlType ct = m_le.GetCurrentPropertyValue(AutomationElement.ControlTypeProperty) as ControlType;
            _Contiguous = ct == ControlType.Calendar;
        }
Ejemplo n.º 5
0
 public TextScenarioTests(AutomationElement element, string testSuite, TestPriorities priority, TypeOfControl typeOfControl, TypeOfPattern typeOfPattern, string dirResults, bool testEvents, IApplicationCommands commands)
     :
     base(element, testSuite, priority, TypeOfControl.UnknownControl, TypeOfPattern.Unknown, null, testEvents, commands)
 {
     try
     {
         _tth = new TextTestsHelper(element, testSuite, priority, TypeOfControl.UnknownControl, TypeOfPattern.Unknown, null, testEvents, commands);
     }
     catch( Exception ex )
     {
         supportsText = false;
         Comment("Unknown exception raised: " + ex.ToString() );
     }
     _NotifiedEvent = new System.Threading.ManualResetEvent(false);
 }
Ejemplo n.º 6
0
        /// -------------------------------------------------------------------
        /// <summary></summary>
        /// -------------------------------------------------------------------
        internal SelectionItemPatternWrapper(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)
        {
            _pattern = (SelectionItemPattern)GetPattern(m_le, m_useCurrent, SelectionItemPattern.Pattern);
            if (_pattern == null)
                throw new Exception(Helpers.PatternNotSupported + ": SelectionItemPattern");

            _selectionContainer = _pattern.Current.SelectionContainer;

            if (_selectionContainer != null)
            {
                _selectionPattern = _selectionContainer.GetCurrentPattern(SelectionPattern.Pattern) as SelectionPattern;
                if (_selectionPattern == null)
                    throw new ArgumentException("Could not find the SelectionContainer's SelectionPattern");
            }

        }
Ejemplo n.º 7
0
        internal TextWrapper(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)
        {
            if (m_le == null)
                throw new ArgumentException("m_le cannot be null");

            _pattern = (TextPattern)m_le.GetCurrentPattern(TextPattern.Pattern);
            _frameworkId = ((string)m_le.GetCurrentPropertyValue(AutomationElement.FrameworkIdProperty)).ToLower(CultureInfo.InvariantCulture);
            _testPriority = TestPriorities.BuildVerificationTest; // default value

            // Determine if tests currently running on Windows Vista
            NativeMethods.OSVERSIONINFOEX ver = new NativeMethods.OSVERSIONINFOEX();
            UnsafeNativeMethods.GetVersionEx(ver);
            if (ver.majorVersion >= 6) // This should account for Windows Vista + Service Packs
                _windowsVista = true;   // It may also occur for Vienna, but the expectation is things
            else                        // could change so much post-Vista, that TextPattern tests will
                _windowsVista = false;  // have to be revisited anyway ((i.e. we will likely be moving to un-managed client)

            Comment("Operating System Version = " + ver.majorVersion + "." + ver.minorVersion + "." + ver.buildNumber);
        }
Ejemplo n.º 8
0
        /// -------------------------------------------------------------------
        /// <summary></summary>
        /// -------------------------------------------------------------------
        protected TogglePatternWrapper(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)
        {
            _pattern = (TogglePattern)element.GetCurrentPattern(TogglePattern.Pattern);

            if (_pattern == null)
            {
                throw new Exception("TogglePattern: " + Helpers.PatternNotSupported);
            }
        }
Ejemplo n.º 9
0
 /// -------------------------------------------------------------------
 /// <summary></summary>
 /// -------------------------------------------------------------------
 public TopLevelEventsScenarioTests(AutomationElement element, string testSuite, TestPriorities priority, TypeOfControl typeOfControl, TypeOfPattern typeOfPattern, string dirResults, bool testEvents, IApplicationCommands commands)
     :
     base(element, testSuite, priority, TypeOfControl.UnknownControl, TypeOfPattern.Unknown, null, testEvents, commands)
 {
 }
Ejemplo n.º 10
0
 /// -------------------------------------------------------------------
 /// <summary></summary>
 /// -------------------------------------------------------------------
 internal InvokePatternWrapper(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("Calling GetPattern(InvokePattern) on " + Library.GetUISpyLook(element));
     m_pattern = (InvokePattern)GetPattern(m_le, m_useCurrent, InvokePattern.Pattern);
 }
Ejemplo n.º 11
0
		/// -------------------------------------------------------------------
		/// <summary></summary>
		/// -------------------------------------------------------------------
		internal ExpandCollapsePatternWrapper(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 = (ExpandCollapsePattern)GetPattern(m_le, m_useCurrent, ExpandCollapsePattern.Pattern);
        }
Ejemplo n.º 12
0
 /// <summary></summary>
 protected WindowPatternWrapper(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 = (WindowPattern)GetPattern(m_le, m_useCurrent, WindowPattern.Pattern);
 }
Ejemplo n.º 13
0
 public AvalonTextScenarioTests(AutomationElement element, string testSuite, TestPriorities priority, TypeOfControl typeOfControl, TypeOfPattern typeOfPattern, string dirResults, bool testEvents, IApplicationCommands commands)
     :
     base(element, testSuite, priority, TypeOfControl.UnknownControl, TypeOfPattern.Unknown, null, testEvents, commands)
 {
     _NotifiedEvent = new System.Threading.ManualResetEvent(false);
 }
Ejemplo n.º 14
0
        /// -------------------------------------------------------------------
        /// <summary></summary>
        /// -------------------------------------------------------------------
        public ScenarioObject(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)
        {
            _testCaseSampleType = TestCaseSampleType.Scenario;
		}
Ejemplo n.º 15
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;
        }
Ejemplo n.º 16
0
 /// -------------------------------------------------------------------
 /// <summary></summary>
 /// -------------------------------------------------------------------
 public MenuScenarioTests(AutomationElement element, string testSuite, TestPriorities priority, TypeOfControl typeOfControl, TypeOfPattern typeOfPattern, string dirResults, bool testEvents, IApplicationCommands commands)
     :
     base(element, testSuite, priority, TypeOfControl.UnknownControl, TypeOfPattern.Unknown, null, testEvents, commands)
 {
 }
Ejemplo n.º 17
0
        static internal int[]      _runtimeID    = new int[0]; // Used to identify if we're on some runtime id as previously


        #endregion Member Variables

        #region TextTestsHelper constructor

        ///---------------------------------------------------------------------------
        /// <summary></summary>
        ///---------------------------------------------------------------------------
        public TextTestsHelper(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)
        {
            // Determine what type of provider is being used (useful for things like supported text units, attributes, etc.)
            string FrameworkId = (string)element.GetCurrentPropertyValue(AutomationElement.FrameworkIdProperty);

            Comment("Type of Provider for this target application is : " + FrameworkId);

            TextLibrary.SetProvider(FrameworkId);
            TextLibraryCount.SetProvider(FrameworkId);

            // Instantiate attribute madness table
            attributeMadness = new Hashtable(attributesCount);

            // Defines expected support for attributes.
            attributeMadness.Add(TextPattern.AnimationStyleAttribute, new AttributeMadness(false, true, true));
            attributeMadness.Add(TextPattern.BackgroundColorAttribute, new AttributeMadness(true, true, false));
            attributeMadness.Add(TextPattern.BulletStyleAttribute, new AttributeMadness(false, true, true));
            attributeMadness.Add(TextPattern.CapStyleAttribute, new AttributeMadness(true, true, true));
            attributeMadness.Add(TextPattern.CultureAttribute, new AttributeMadness(false, false, false));
            attributeMadness.Add(TextPattern.FontNameAttribute, new AttributeMadness(true, true, false));
            attributeMadness.Add(TextPattern.FontSizeAttribute, new AttributeMadness(true, true, false));
            attributeMadness.Add(TextPattern.FontWeightAttribute, new AttributeMadness(true, true, false));
            attributeMadness.Add(TextPattern.ForegroundColorAttribute, new AttributeMadness(true, true, false));
            attributeMadness.Add(TextPattern.HorizontalTextAlignmentAttribute, new AttributeMadness(true, true, true));
            attributeMadness.Add(TextPattern.IndentationFirstLineAttribute, new AttributeMadness(false, true, false));
            attributeMadness.Add(TextPattern.IndentationLeadingAttribute, new AttributeMadness(false, true, false));
            attributeMadness.Add(TextPattern.IndentationTrailingAttribute, new AttributeMadness(false, true, false));
            attributeMadness.Add(TextPattern.IsHiddenAttribute, new AttributeMadness(false, true, false));
            attributeMadness.Add(TextPattern.IsItalicAttribute, new AttributeMadness(true, true, false));
            attributeMadness.Add(TextPattern.IsReadOnlyAttribute, new AttributeMadness(true, true, false));
            attributeMadness.Add(TextPattern.IsSubscriptAttribute, new AttributeMadness(false, true, false));
            attributeMadness.Add(TextPattern.IsSuperscriptAttribute, new AttributeMadness(false, true, false));
            attributeMadness.Add(TextPattern.MarginBottomAttribute, new AttributeMadness(false, false, false));
            attributeMadness.Add(TextPattern.MarginLeadingAttribute, new AttributeMadness(false, false, false));
            attributeMadness.Add(TextPattern.MarginTopAttribute, new AttributeMadness(false, false, false));
            attributeMadness.Add(TextPattern.MarginTrailingAttribute, new AttributeMadness(false, false, false));
            attributeMadness.Add(TextPattern.OutlineStylesAttribute, new AttributeMadness(false, true, false));
            attributeMadness.Add(TextPattern.OverlineColorAttribute, new AttributeMadness(false, false, false));
            attributeMadness.Add(TextPattern.OverlineStyleAttribute, new AttributeMadness(false, false, false));
            attributeMadness.Add(TextPattern.StrikethroughColorAttribute, new AttributeMadness(false, false, false));
            attributeMadness.Add(TextPattern.StrikethroughStyleAttribute, new AttributeMadness(true, true, false));
            attributeMadness.Add(TextPattern.TabsAttribute, new AttributeMadness(false, true, false));
            attributeMadness.Add(TextPattern.TextFlowDirectionsAttribute, new AttributeMadness(false, false, false));
            attributeMadness.Add(TextPattern.UnderlineColorAttribute, new AttributeMadness(false, false, false));
            attributeMadness.Add(TextPattern.UnderlineStyleAttribute, new AttributeMadness(true, true, false));
        }
Ejemplo n.º 18
0
 public AvalonTextScenarioTests(AutomationElement element, string testSuite, TestPriorities priority, TypeOfControl typeOfControl, TypeOfPattern typeOfPattern, string dirResults, bool testEvents, IApplicationCommands commands)
     :
     base(element, testSuite, priority, TypeOfControl.UnknownControl, TypeOfPattern.Unknown, null, testEvents, commands)
 {
     _NotifiedEvent = new System.Threading.ManualResetEvent(false);
 }
Ejemplo n.º 19
0
        /// -------------------------------------------------------------------
        /// <summary></summary>
        /// -------------------------------------------------------------------
        public PatternObject(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)
        {
            _testCaseSampleType = TestCaseSampleType.Pattern;
        }
Ejemplo n.º 20
0
 /// -------------------------------------------------------------------
 /// <summary>
 /// Constructor
 /// </summary>
 /// -------------------------------------------------------------------
 public TestObject(AutomationElement element, string testSuite, TestPriorities priority, TypeOfControl typeOfControl, TypeOfPattern typeOfPattern, string dirResults, bool testEvents, IApplicationCommands commands)
 {
     m_le = element;
     _appCommands = commands;
     m_TestPriority = priority;
     m_TypeOfControl = typeOfControl;
     m_TypeOfPattern = typeOfPattern;
     _testEvents = testEvents;
     _testSuite = testSuite;
     m_TestStep = 0;
     _testCaseAttribute = null;
     TestObject.m_testObject = this;
     #if NATIVE_UIA
     GetGlobalizedQueryString(m_le);
     #endif
 }