-
Notifications
You must be signed in to change notification settings - Fork 724
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix bounce ease producing invalid final value
- Loading branch information
Showing
2 changed files
with
88 additions
and
22 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
src/Uno.UI.Tests/Windows_UI_Xaml_Media_Animation/Given_BounceEase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Windows.UI.Xaml.Media.Animation; | ||
using FluentAssertions; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace Uno.UI.Tests.Windows_UI_Xaml_Media_Animation | ||
{ | ||
[TestClass] | ||
public class Given_BounceEase | ||
{ | ||
[TestMethod] | ||
public void When_FinalValueGreaterThanInitial() | ||
{ | ||
var sut = new BounceEase(); | ||
|
||
EaseCore(0.0).Should().BeApproximately(100, .1); | ||
EaseCore(1.0).Should().BeApproximately(200, .1); | ||
|
||
double EaseCore(double normalizedTime) | ||
=> sut.Ease( | ||
currentTime: normalizedTime, duration: 1.0, | ||
startValue: 100, finalValue: 200); | ||
} | ||
|
||
[TestMethod] | ||
public void When_FinalValueLowerThanInitial() | ||
{ | ||
var sut = new BounceEase(); | ||
|
||
EaseCore(0.0).Should().BeApproximately(200, .1); | ||
EaseCore(1.0).Should().BeApproximately(100, .1); | ||
|
||
double EaseCore(double normalizedTime) | ||
=> sut.Ease( | ||
currentTime: normalizedTime, duration: 1.0, | ||
startValue: 200, finalValue: 100); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters