From 93d7e3ad65892b6912e2239e75e7dc2ad10d862f Mon Sep 17 00:00:00 2001 From: Luke Longley <18177025+llongley@users.noreply.github.com> Date: Thu, 7 Apr 2022 03:07:27 -0700 Subject: [PATCH] Updating ProgressRing to not report the RangeValue pattern when it's indeterminate. (#6941) ProgressRing should not report the RangeValue pattern when it's indeterminate, as in that case it has no value to report. --- .../InteractionTests/ProgressRingTests.cs | 19 +++++++++++++++++-- .../ProgressRingAutomationPeer.cpp | 9 ++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/dev/ProgressRing/InteractionTests/ProgressRingTests.cs b/dev/ProgressRing/InteractionTests/ProgressRingTests.cs index f70834700c..b94fdc4626 100644 --- a/dev/ProgressRing/InteractionTests/ProgressRingTests.cs +++ b/dev/ProgressRing/InteractionTests/ProgressRingTests.cs @@ -46,7 +46,7 @@ public void TestCleanup() } [TestMethod] - public void ChangeStateTest() + public void ChangeStateTest() { using (var setup = new TestSetupHelper("ProgressRing Tests")) { @@ -93,7 +93,7 @@ public void ChangeStateTest() Log.Comment("IsActive set to false updates ProgressRing to Inactive state"); isActiveCheckBox.ToggleAndWait(); - + Verify.AreEqual("Inactive", visualStateText.DocumentText); Log.Comment("Verify Lottie animation is not playing when in Inactive state"); @@ -298,5 +298,20 @@ public void UpdateMinMaxTest() Verify.IsGreaterThan(diff, Convert.ToDouble(0), "Value of ProgressBar increments properly within range with decimal Minimum and Maximum"); } } + + [TestMethod] + public void VerifyIndeterminateProgressRingDoesNotImplementRangeValuePattern() + { + using (var setup = new TestSetupHelper("ProgressRing Tests")) + { + UIObject progressRing = FindElement.ByName("Busy TestProgressRing"); + + Verify.IsNotNull(progressRing); + + RangeValueImplementation rangeValueImplementation = new RangeValueImplementation(progressRing); + + Verify.IsFalse(rangeValueImplementation.IsAvailable); + } + } } } diff --git a/dev/ProgressRing/ProgressRingAutomationPeer.cpp b/dev/ProgressRing/ProgressRingAutomationPeer.cpp index 2e32ba76ed..cd10c66d13 100644 --- a/dev/ProgressRing/ProgressRingAutomationPeer.cpp +++ b/dev/ProgressRing/ProgressRingAutomationPeer.cpp @@ -19,7 +19,14 @@ winrt::IInspectable ProgressRingAutomationPeer::GetPatternCore(winrt::PatternInt { if (patternInterface == winrt::PatternInterface::RangeValue) { - return *this; + if (GetImpl()->IsIndeterminate()) + { + return nullptr; + } + else + { + return *this; + } } return __super::GetPatternCore(patternInterface);