Inheritance: IDisposable
        /// -------------------------------------------------------------------
        /// <summary></summary>
        /// -------------------------------------------------------------------
        private void TS_GetFirstSubmenu(ref TestMenu menu, CheckType checkType)
        {

            IWUIMenuCommands menuCommands = _appCommands.GetIWUIMenuCommands();
            TestMenu m = menuCommands.GetMenuBar();
            if (m == null)
                ThrowMe(checkType, "Could not get menu bar");


            if ((m = m.GetFirstSubMenu()) == null)
                ThrowMe(checkType, "Could not get 1st sub menu");

            Comment("Found menu : " + m.AutomationElement.Current.Name);

            menu = m;

            m_TestStep++;
        }
        /// -------------------------------------------------------------------
        /// <summary></summary>
        /// -------------------------------------------------------------------
        private void TS_ExpandMenu(TestMenu tmenu, CheckType checkType)
        {
            // Step: Expand the 1st menu so that a WindowOpenedEvent is fired
            Comment(tmenu.AutomationElement.Current.Name);
            tmenu.Expand();

            m_TestStep++;
        }
        /// -------------------------------------------------------------------
        /// <summary></summary>
        /// -------------------------------------------------------------------
        private void TS_GetMenuItemsSubMenu(TestMenu tmenu, out AutomationElement menu, CheckType checkType)
        {
            menu = TreeWalker.ControlViewWalker.GetFirstChild(tmenu.AutomationElement);
            Comment("Found 1st child of '" + tmenu.AutomationElement.Current.Name + "' -> '" + menu.Current.Name + "'");

            m_TestStep++;
        }
Exemple #4
0
        /// -------------------------------------------------------------------
        /// <summary>
        /// This will test that the menu and it's menu names are as defined in the Xml tree
        /// </summary>
        /// -------------------------------------------------------------------
        private void TS_VerifyXmlToTree(XmlNode xmlNode, TestMenu menu)
        {
            // If they are both null, we are at the end...just return then
            if (xmlNode == null && menu == null)
                return;

            // Make sure both are either null, or something
            if ((xmlNode == null && menu != null) || (xmlNode != null && menu == null))
                ThrowMe(CheckType.Verification, "Mismatch1!");

            string curName = menu.AutomationElement.GetCurrentPropertyValue(AutomationElement.NameProperty) as string;
            string expName = new StringBuilder(xmlNode.Name).Replace("_", " ").ToString();

            // Verify that the NameProperty returned something valid
            if (String.IsNullOrEmpty(curName))
                ThrowMe(CheckType.Verification, "AutomationElement.NameProperty is empty or null");

            // Everything looks good, so tell the user what we are doing
            Comment("Comparing expected name(" + expName + ") with actual name(" + curName + ")");

            if (expName != curName)
                ThrowMe(CheckType.Verification, "Expected element with name of " + expName + ", yet it was " + curName);

            // MenuItems need to be expanded to get to the children.  Menu's don't since they are only containers that are
            // already opened.
            if (menu.Expandable)
                menu.Expand();

            // Recurse the children and siblings
            if (xmlNode.FirstChild != null)
            {
                TS_VerifyXmlToTree(xmlNode.FirstChild, menu.GetFirstSubMenu());
            }

            if (xmlNode.NextSibling != null)
            {
                TS_VerifyXmlToTree(xmlNode.NextSibling, menu.GetNextSiblingMenu());
            }

        }