using System; using System.Collections.Generic; using System.Text; using NUnit.Framework; using SalsaModel.Scheduling; using SalsaModel.Actions; namespace SalsaModel.Tests { [TestFixture] public class TestWeightChange { [Test] public void Test1() { SalsaMover mover = new SalsaMover(BodyGeometry.Andy(), Location.Origin); mover.CheckPosture(); TimeLine tl = new TimeLine(); tl.Add(0.0, 1.0, new HeelMoverAction(mover, PositionModel.Side.Left)); tl.Add(1.0, 1.0, new HeelMoverAction(mover, PositionModel.Side.Right)); double prev = -1.0; for (double now = 0.0; now <= 2.00; now += 0.1) { try { foreach (IAction action in tl.EndedEventsBetween(prev, now)) { action.End(); } foreach (IAction action in tl.StartedEventsBetween(prev, now)) { action.Start(); } foreach (ActiveEvent evt in tl.ActiveEventsAt(now)) { evt.Event.Update(evt.Percent); } mover.AlignKnees(); mover.CheckPosture(); } catch (Exception e) { throw new Exception("Failure at " + now.ToString() + ": " + e.Message, e); } prev = now; } } } }