GetCachedPropertyValue() public method

public GetCachedPropertyValue ( AutomationProperty property ) : object
property AutomationProperty
return object
Ejemplo n.º 1
0
        /// -------------------------------------------------------------------
        /// <summary>
        /// Test that the element's enable state is the same as 'isEnabled' argument
        /// </summary>
        /// -------------------------------------------------------------------
        internal void TS_ElementEnabled(AutomationElement element, bool isEnabled, CheckType checkType)
        {
            bool enabled;

            if (m_useCurrent)
            {
                enabled = (bool)element.GetCurrentPropertyValue(AutomationElement.IsEnabledProperty);
            }
            else
            {
                enabled = (bool)element.GetCachedPropertyValue(AutomationElement.IsEnabledProperty);
            }

            if (enabled != isEnabled)
            {
                string errorStr;
                // Adding switch instead of if statements since this is most likely
                // an enumeration instead of a t/f such as soft focus states to be add
                // later.
                switch (isEnabled)
                {
                    case true:
                        errorStr = "Element is not enabled and is expected to be enabled";
                        break;
                    case false:
                        errorStr = "Element is enabled and is expected not to be enabled";
                        break;
                    default:
                        throw new ArgumentException("Need to handle " + isEnabled);
                }
                ThrowMe(checkType, errorStr);
            }

            m_TestStep++;

        }
Ejemplo n.º 2
0
 /// -------------------------------------------------------------------
 /// <summary></summary>
 /// -------------------------------------------------------------------
 object pattern_GetProperty(AutomationElement element, AutomationProperty property)
 {
     if (m_useCurrent)
         return element.GetCurrentPropertyValue(property);
     else
         return element.GetCachedPropertyValue(property);
 }