Пример #1
0
    /// <summary>
    /// Changes TypeOfControl from PlayerInput
    /// </summary>
    /// <param name="typeOfControl">TypeOfControl to change to</param>
    public void ChangeTypeOfControl(TypeOfControl typeOfControl)
    {
        IPlayerInput input;

        input = FindObjectOfType <PlayerInput>();
        input.ChangeTypeOfControl(typeOfControl);
    }
Пример #2
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;

        }
Пример #3
0
        public AutomationElement[] GetElementsByControlType(TypeOfControl CtrlType, AutomationElement ParentElement)
        {
            Int32       Cnt        = 0;
            ControlType MyCtrlType = GetControlType(CtrlType);

            AutomationElement[] aeTemp = null;
            AutomationElement[] aecAll = GetAllElement(ParentElement);
            foreach (AutomationElement aeElement in aecAll)
            {
                if (aeElement.Current.ControlType == MyCtrlType)
                {
                    Cnt++;
                }
            }

            aeTemp = new AutomationElement[Cnt];
            Cnt    = 0;
            foreach (AutomationElement aeElement in aecAll)
            {
                if (aeElement.Current.ControlType == MyCtrlType)
                {
                    aeTemp[Cnt] = aeElement;
                    Cnt++;
                }
            }

            return(aeTemp);
        }
Пример #4
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);
 }
Пример #5
0
		/// -------------------------------------------------------------------
		/// <summary>
        /// Get the TableItemPattern on the element
        /// </summary>
		/// -------------------------------------------------------------------
		public TableItemTests(AutomationElement element, TestPriorities priority, string dirResults, bool testEvents, TypeOfControl typeOfControl, IApplicationCommands commands)
            :
            base(element, TestSuite, priority, typeOfControl, TypeOfPattern.TableItem, dirResults, testEvents, commands)
        {
            m_pattern = (TableItemPattern)GetPattern(m_le, m_useCurrent, TableItemPattern.Pattern);
            if (m_pattern == null)
                throw new Exception(Helpers.PatternNotSupported);
        }
Пример #6
0
		/// -------------------------------------------------------------------
		/// <summary></summary>
		/// -------------------------------------------------------------------
		public MultipleViewTests(AutomationElement element, TestPriorities priority, string dirResults, bool testEvents, TypeOfControl typeOfControl, IApplicationCommands commands)
            :
            base(element, TestSuite, priority, typeOfControl, TypeOfPattern.MultipleView, dirResults, testEvents, commands)
        {
            m_pattern = (MultipleViewPattern)element.GetCurrentPattern(MultipleViewPattern.Pattern);
            if (m_pattern == null)
                throw new Exception(Helpers.PatternNotSupported);
        }
Пример #7
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;
        }
Пример #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);
        }
Пример #9
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);
 }
Пример #10
0
        public AutomationElement GetElementByContrlTypeAndName(TypeOfControl CtrlType, string name, AutomationElement ParentElement)
        {
            AutomationElement[] aeTemp = null;

            aeTemp = GetElementsByControlType(CtrlType, ParentElement);

            foreach (AutomationElement ae in aeTemp)
            {
                if (ae.Current.Name == name)
                {
                    return(ae);
                }
            }
            return(null);
        }
Пример #11
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");
            }

        }
Пример #12
0
        /// <summary>
        /// Metoda sprawdza czy dany KeyCode jest zajety przez jakas funkcjonalnosc.
        /// </summary>
        /// <param name="presentKeyCode">Aktualny KeyCode dla danej funkcjonalnosci.</param>
        /// <param name="newKeyCode">Nowy KeyCode dla danej funkcjonalnosci.</param>
        /// <returns>Jesli oba parametry sa rowne, to nie ma konfliktu - zwroci false.
        /// Jesli KeyCode podany w drugim parametrze jest zajety przez jakas funkjonalnosc, to metoda zwroci true.
        /// W przeciwnym przypadku false.</returns>

        /*
         * public static bool CheckKeyCodeConflict(KeyCode presentKeyCode, KeyCode newKeyCode)
         * {
         *  if (presentKeyCode != newKeyCode)
         *  {
         *      KeyCode tmpKeyCode;
         *      PropertyInfo[] properties = KeyMap.Instance.GetType().GetProperties();
         *      for (int i = 0; i < properties.Length; i++)
         *      {
         *              object obj = properties[i].GetValue(Instance, null);
         *              if(obj is KeyCode){
         *                      tmpKeyCode = (KeyCode)obj;
         *                      if (tmpKeyCode == newKeyCode){
         *                      return true;
         *                      }
         *              }
         *
         *      }
         *  }
         *  return false;
         * }
         *
         *
         *
         *
         */


        /// <summary>
        ///
        /// </summary>
        /// <param name="propertyName"></param>
        /// <param name="newValue"></param>
        /// <param name="type"></param>
        /// <param name="conflictExceptions"></param>
        /// <returns></returns>
        public static bool UpdateProperty(String propertyName, object newValue, TypeOfControl type, String[] conflictExceptions)
        {
            if (CheckKeyCodeConflict(propertyName, newValue, type, conflictExceptions))
            {
                return(false);
            }

            PropertyInfo[] properties = KeyMap.Instance.GetType().GetProperties();
            for (int i = 0; i < properties.Length; i++)
            {
                if (properties[i].Name.Equals(propertyName, StringComparison.InvariantCultureIgnoreCase))
                {
                    properties[i].SetValue(KeyMap.Instance, newValue, null);
                    KeyMap.Instance.Value = KeyMap.Instance.Value;
                    return(true);
                }
            }

            return(false);    // no such property
        }
Пример #13
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);
        }
Пример #14
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);
        }
Пример #15
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);
 }
Пример #16
0
 /// -------------------------------------------------------------------
 /// <summary>
 /// Get the tablepattern on the element
 /// </summary>
 /// -------------------------------------------------------------------
 public TableTests(AutomationElement element, TestPriorities priority, string dirResults, bool testEvents, TypeOfControl typeOfControl, IApplicationCommands commands)
     :
     base(element, TestSuite, priority, typeOfControl, TypeOfPattern.Table, dirResults, testEvents, commands)
 {
     m_pattern = (TablePattern)GetPattern(m_le, m_useCurrent, TablePattern.Pattern);
     if (m_pattern == null)
     {
         throw new Exception(Helpers.PatternNotSupported);
     }
 }
Пример #17
0
 /// -------------------------------------------------------------------
 /// <summary></summary>
 /// -------------------------------------------------------------------
 public ToggleTests(AutomationElement element, TestPriorities priority, string dirResults, bool testEvents, TypeOfControl typeOfControl, IApplicationCommands commands)
     :
     base(element, TestSuite, priority, typeOfControl, TypeOfPattern.Toggle, dirResults, testEvents, commands)
 {
 }
Пример #18
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;
        }
Пример #19
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)
 {
 }
 public ControlTypeAttribute(TypeOfControl type)
 {
     this.type = type;
 }
Пример #21
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
 }
Пример #22
0
 /// -------------------------------------------------------------------
 /// <summary></summary>
 /// -------------------------------------------------------------------
 public ScrollTests(AutomationElement element, TestPriorities priority, string dirResults, bool testEvents, TypeOfControl typeOfControl, IApplicationCommands commands)
     :
     base(element, TestSuite, priority, typeOfControl, TypeOfPattern.Scroll, dirResults, testEvents, commands)
 {
     DetermineValidPositions();
 }
Пример #23
0
 /// -------------------------------------------------------------------
 /// <summary></summary>
 /// -------------------------------------------------------------------
 public MultipleViewTests(AutomationElement element, TestPriorities priority, string dirResults, bool testEvents, TypeOfControl typeOfControl, IApplicationCommands commands)
     :
     base(element, TestSuite, priority, typeOfControl, TypeOfPattern.MultipleView, dirResults, testEvents, commands)
 {
     m_pattern = (MultipleViewPattern)element.GetCurrentPattern(MultipleViewPattern.Pattern);
     if (m_pattern == null)
     {
         throw new Exception(Helpers.PatternNotSupported);
     }
 }
Пример #24
0
        public TextTests(AutomationElement element, TestPriorities priority, string dirResults, bool testEvents, TypeOfControl typeOfControl, IApplicationCommands commands)
            : base(element, TestSuite, priority, typeOfControl, TypeOfPattern.Text, dirResults, testEvents, commands)
        {
            if (element == null)
                throw new ArgumentException("element cannot be null");

            _pattern = (TextPattern)element.GetCurrentPattern(TextPattern.Pattern);
        }
Пример #25
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));
        }
Пример #26
0
 /// -------------------------------------------------------------------
 /// <summary></summary>
 /// -------------------------------------------------------------------
 public SelectionTests(AutomationElement element, TestPriorities priority, string dirResults, bool testEvents, TypeOfControl typeOfControl, IApplicationCommands commands)
     :
     base(element, TestSuite, priority, typeOfControl, TypeOfPattern.Selection, dirResults, testEvents, commands)
 {
 }
Пример #27
0
 /// -------------------------------------------------------------------
 /// <summary></summary>
 /// -------------------------------------------------------------------
 public InvokeTests(AutomationElement element, TestPriorities priority, string dirResults, bool testEvents, TypeOfControl typeOfControl, IApplicationCommands commands)
     :
     base(element, TestSuite, priority, typeOfControl, TypeOfPattern.Invoke, dirResults, testEvents, commands)
 {
     if (m_pattern == null)
         throw new Exception(Helpers.PatternNotSupported);
 }
Пример #28
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)
 {
 }
Пример #29
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);
 }
Пример #30
0
 private void OnEnable()
 {
     index             = 0;
     lastTypeOfControl = input.CurrentControl;
     tutorials?[0]?.SetActive(true);
 }
Пример #31
0
 /// -------------------------------------------------------------------
 /// <summary></summary>
 /// -------------------------------------------------------------------
 public InvokeTests(AutomationElement element, TestPriorities priority, string dirResults, bool testEvents, TypeOfControl typeOfControl, IApplicationCommands commands)
     :
     base(element, TestSuite, priority, typeOfControl, TypeOfPattern.Invoke, dirResults, testEvents, commands)
 {
     if (m_pattern == null)
     {
         throw new Exception(Helpers.PatternNotSupported);
     }
 }
Пример #32
0
        public static bool CheckKeyCodeConflict(String propertyName, object newKeyCode, TypeOfControl type, String[] exceptions)
        {
            KeyCode tmpKeyCode;

            PropertyInfo[] properties = KeyMap.Instance.GetType().GetProperties();
            for (int i = 0; i < properties.Length; i++)
            {
                if (-1 != Array.FindIndex(exceptions, (String exception) => properties[i].Name.Equals(exception, StringComparison.InvariantCultureIgnoreCase)))
                {
                    //
                    continue;
                }

                var attribute = Attribute.GetCustomAttribute(properties[i], typeof(ControlTypeAttribute)) as ControlTypeAttribute;


                if (attribute != null && !properties[i].Name.Equals(propertyName, StringComparison.InvariantCultureIgnoreCase))
                {
                    if (!attribute.Type.Equals(type))
                    {
                        continue;
                    }
                    // other key
                    object obj = properties[i].GetValue(Instance, null);
                    if (obj is KeyCode && newKeyCode is KeyCode)
                    {
                        tmpKeyCode = (KeyCode)obj;
                        if (tmpKeyCode == (KeyCode)newKeyCode)
                        {
                            return(true);
                        }
                    }
                    if (obj is int && newKeyCode is int)
                    {
                        if (obj.Equals(newKeyCode))
                        {
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }
Пример #33
0
        public ControlType GetControlType(TypeOfControl controlType)
        {
            switch (controlType)
            {
            case TypeOfControl.TextBox:
            {
                return(ControlType.Edit);
            }

            case TypeOfControl.ComboBox:
            {
                return(ControlType.ComboBox);
            }

            case TypeOfControl.Grid:
            {
                return(ControlType.DataGrid);
            }

            case TypeOfControl.GridLine:
            {
                return(ControlType.DataItem);
            }

            case TypeOfControl.Window:
            {
                return(ControlType.Window);
            }

            case TypeOfControl.MenuBar:
            {
                return(ControlType.MenuBar);
            }

            case TypeOfControl.Menu:
            {
                return(ControlType.Menu);
            }

            case TypeOfControl.SubMenu:
            {
                return(ControlType.MenuItem);
            }

            case TypeOfControl.Panel:
            {
                return(ControlType.Pane);
            }

            case TypeOfControl.CheckBox:
            {
                return(ControlType.CheckBox);
            }

            case TypeOfControl.Header:
            {
                return(ControlType.Header);
            }

            case TypeOfControl.Text:
            {
                return(ControlType.Text);
            }

            case TypeOfControl.Document:
            {
                return(ControlType.Document);
            }

            case TypeOfControl.ToolBar:
            {
                return(ControlType.ToolBar);
            }

            case TypeOfControl.Button:
            {
                return(ControlType.Button);
            }

            case TypeOfControl.Custom:
            {
                return(ControlType.Custom);
            }

            case TypeOfControl.HeaderItem:
            {
                return(ControlType.HeaderItem);
            }

            case TypeOfControl.Tree:
            {
                return(ControlType.Tree);
            }

            case TypeOfControl.TreeItem:
            {
                return(ControlType.TreeItem);
            }

            default:
            {
                return(null);
            }
            }
        }
Пример #34
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;
		}
Пример #35
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);
            }
        }
Пример #36
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);
 }
Пример #37
0
 public static bool UpdateProperty(String propertyName, object newValue, TypeOfControl type)
 {
     return(UpdateProperty(propertyName, newValue, type, new string[0] {
     }));
 }
Пример #38
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);
 }
Пример #39
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;
        }
Пример #40
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="propertyName"></param>
 /// <param name="newKeyCode"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public static bool CheckKeyCodeConflict(String propertyName, object newKeyCode, TypeOfControl type)
 {
     return(CheckKeyCodeConflict(propertyName, newKeyCode, type, new String[0] {
     }));
 }