A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

36 lines
770 B

using System;
using Avalonia.Animation;
namespace Avalonia.Base.UnitTests.Animation
{
internal class TestClock : IClock, IDisposable
{
private TimeSpan _curTime;
private IObserver<TimeSpan>? _observer;
public PlayState PlayState { get; set; } = PlayState.Run;
public void Dispose()
{
_observer?.OnCompleted();
}
public void Step(TimeSpan time)
{
_observer?.OnNext(time);
}
public void Pulse(TimeSpan time)
{
_curTime += time;
_observer?.OnNext(_curTime);
}
public IDisposable Subscribe(IObserver<TimeSpan> observer)
{
_observer = observer;
return this;
}
}
}