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)); }
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)); }
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); }
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)); }