Skip to content

Commit

Permalink
Updating ProgressRing to not report the RangeValue pattern when it's …
Browse files Browse the repository at this point in the history
…indeterminate. (#6941)

ProgressRing should not report the RangeValue pattern when it's indeterminate, as in that case it has no value to report.
  • Loading branch information
llongley authored Apr 7, 2022
1 parent e59614e commit 93d7e3a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
19 changes: 17 additions & 2 deletions dev/ProgressRing/InteractionTests/ProgressRingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void TestCleanup()
}

[TestMethod]
public void ChangeStateTest()
public void ChangeStateTest()
{
using (var setup = new TestSetupHelper("ProgressRing Tests"))
{
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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);
}
}
}
}
9 changes: 8 additions & 1 deletion dev/ProgressRing/ProgressRingAutomationPeer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 93d7e3a

Please sign in to comment.