using NUnit.Framework; using System.Threading.Tasks; namespace Xamarin.Forms.Core.UnitTests { [TestFixture] public class AnimationTests : BaseTestFixture { [Test] //https://bugzilla.xamarin.com/show_bug.cgi?id=51424 public async void AnimationRepeats() { var box = new BoxView(); Assume.That(box.Rotation, Is.EqualTo(0d)); var sb = new Animation(); var animcount = 0; var rot45 = new Animation(d => { box.Rotation = d; if (d > 44) animcount++; }, box.Rotation, box.Rotation + 45); sb.Add(0, .5, rot45); Assume.That(box.Rotation, Is.EqualTo(0d)); var i = 0; sb.Commit(box, "foo", length: 100, repeat: () => ++i < 2); await Task.Delay(250); Assert.That(animcount, Is.EqualTo(2)); } } }