ManualUpdateTest.cs 842 B

123456789101112131415161718192021222324252627282930313233
  1. using NUnit.Framework;
  2. using UnityEngine;
  3. using UnityEngine.TestTools.Utils;
  4. namespace LitMotion.Tests.Runtime
  5. {
  6. public class ManualUpdateTest
  7. {
  8. [Test]
  9. public void Test_FloatMotion()
  10. {
  11. ManualMotionDispatcher.Reset();
  12. var value = 0f;
  13. var endValue = 10f;
  14. var handle = LMotion.Create(value, endValue, 2f)
  15. .WithScheduler(MotionScheduler.Manual)
  16. .Bind(x =>
  17. {
  18. value = x;
  19. Debug.Log(x);
  20. });
  21. while (handle.IsActive())
  22. {
  23. var deltaTime = 0.1f;
  24. ManualMotionDispatcher.Update(deltaTime);
  25. }
  26. Assert.That(value, Is.EqualTo(endValue).Using(FloatEqualityComparer.Instance));
  27. }
  28. }
  29. }