Example #1
0
        private static bool IsLargeChangeValueNull(IA11yElement e)
        {
            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }

            var rangeValue = e.GetPattern(PatternType.UIA_RangeValuePatternId);

            if (rangeValue == null)
            {
                return(true);
            }

            var largeChange = rangeValue.GetValue <double>("LargeChange");

            return(largeChange == default(double));
        }
Example #2
0
        private static bool AreMinMaxValuesCorrect(IA11yElement e)
        {
            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }

            var rangeValue = e.GetPattern(PatternType.UIA_RangeValuePatternId);

            if (rangeValue == null)
            {
                throw new Exception($"Expected {nameof(rangeValue)} not to be null");
            }

            return(PropertyValueMatches(rangeValue, "Minimum", 0.0) &&
                   PropertyValueMatches(rangeValue, "Maximum", 100.0) &&
                   PropertyValueMatches(rangeValue, "IsReadOnly", true));
        }
Example #3
0
        private static bool IsTextSelectionSupported(IA11yElement e)
        {
            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }

            var textPattern = e.GetPattern(PatternType.UIA_TextPatternId);

            if (textPattern == null)
            {
                return(false);
            }

            var supportsSelection = textPattern.GetValue <UIAutomationClient.SupportedTextSelection>("SupportedTextSelection");

            return(supportsSelection != UIAutomationClient.SupportedTextSelection.SupportedTextSelection_None);
        }
Example #4
0
        private static bool IsVerticallyScrollable(IA11yElement e)
        {
            if (e == null)
            {
                throw new ArgumentException(nameof(e));
            }

            var scrollPattern = e.GetPattern(PatternType.UIA_ScrollPatternId);

            if (scrollPattern == null)
            {
                return(false);
            }

            var verticalScrollPercent = scrollPattern.GetValue <double>(VerticalScrollPercentProperty);

            // DirectUI framework returns "NaN" instead of setting IsXXXScrollable to false in case it is not scrollable.
            return(scrollPattern.GetValue <bool>(VerticallyScrollableProperty) &&
                   !double.IsNaN(verticalScrollPercent));
        }