Beispiel #1
0
        public void TimelineClockControlSeekTest()
        {
            TestRootClock rootClock = new TestRootClock();
            TestTimeline  timeline  = new TestTimeline();
            TimelineClock clock     = (TimelineClock)timeline.CreateClock();

            clock.Begin(rootClock);
            rootClock.Tick(TimeSpan.FromSeconds(0.1));
            Assert.AreEqual(ClockProgressState.Active, clock.CurrentState.ProgressState);
            Assert.AreEqual(0.1, clock.CurrentState.Progress);

            clock.SeekOffset(TimeSpan.FromSeconds(0.1));
            rootClock.Tick(TimeSpan.FromSeconds(0.2));
            Assert.AreEqual(0.1, clock.CurrentState.Progress);

            clock.Seek(TimeSpan.FromSeconds(0.9));
            rootClock.Tick(TimeSpan.FromSeconds(0.3));
            Assert.AreEqual(1, clock.CurrentState.Progress);
        }
Beispiel #2
0
        public void TimelineClockControlBasicTest()
        {
            TestRootClock rootClock = new TestRootClock();
            TestTimeline  timeline  = new TestTimeline();
            TimelineClock clock     = (TimelineClock)timeline.CreateClock();

            rootClock.Tick(TimeSpan.FromSeconds(10));

            Assert.AreEqual(ClockProgressState.BeforeStarted, clock.CurrentState.ProgressState);
            Assert.AreEqual(0, clock.CurrentState.Progress);
            Assert.AreEqual(0, clock.CurrentState.Iteration);

            clock.Begin(rootClock);

            Assert.AreEqual(ClockProgressState.Active, clock.CurrentState.ProgressState);
            Assert.AreEqual(0, clock.CurrentState.Progress);

            rootClock.Tick(TimeSpan.FromSeconds(10.1));

            Assert.AreEqual(ClockProgressState.Active, clock.CurrentState.ProgressState);
            Assert.AreEqual(0.1, clock.CurrentState.Progress);

            clock.Pause();
            rootClock.Tick(TimeSpan.FromSeconds(10.2));

            Assert.AreEqual(ClockProgressState.Active, clock.CurrentState.ProgressState);
            Assert.AreEqual(0.1, clock.CurrentState.Progress);

            clock.Resume();
            rootClock.Tick(TimeSpan.FromSeconds(10.3));

            Assert.AreEqual(ClockProgressState.Active, clock.CurrentState.ProgressState);
            Assert.AreEqual(0.2, clock.CurrentState.Progress);

            clock.Stop();
            rootClock.Tick(TimeSpan.FromSeconds(10.4));

            Assert.AreEqual(ClockProgressState.AfterEnded, clock.CurrentState.ProgressState);
            Assert.AreEqual(1, clock.CurrentState.Progress);
        }