Beispiel #1
0
        public void TestBasicGrid()
        {
            var grid = new Grid(new List <object>
            {
                new { Name = "Adam", State = "Washington" },
                new { Name = "Bob", State = "New Jersey" }
            });

            var app = new CliTestHarness(this.TestContext, 80, 30);

            app.LayoutRoot.Add(grid).Fill();
            app.QueueAction(() =>
            {
                app.SetTimeout(() => app.SendKey(new ConsoleKeyInfo((char)0, ConsoleKey.DownArrow, false, false, false)), TimeSpan.FromMilliseconds(333));
                app.SetTimeout(() => app.SendKey(new ConsoleKeyInfo((char)0, ConsoleKey.UpArrow, false, false, false)), TimeSpan.FromMilliseconds(666));
                app.SetTimeout(() => app.Stop(), TimeSpan.FromMilliseconds(1000));
            });
            app.Start().Wait();

            app.AssertThisTestMatchesLKG();
        }
Beispiel #2
0
        public async Task TestAnimatorInTimeAsync()
        {
            var app           = new CliTestHarness(TestContext, 40, 1, true);
            var delayProvider = new KeyframeDelayProvider(app);

            app.InvokeNextCycle(() =>
            {
                var panel = app.LayoutRoot.Add(new SpaceTimePanel(40, 1));
                panel.SpaceTime.Start();
                app.SecondsBetweenKeyframes = panel.SpaceTime.Increment.TotalSeconds;
                panel.SpaceTime.Invoke(async() =>
                {
                    panel.RealTimeViewing.Enabled = false;
                    var element = panel.SpaceTime.Add(new SpacialElement());
                    element.ResizeTo(1, 1);
                    await app.PaintAndRecordKeyFrameAsync();

                    await Animator.AnimateAsync(new FloatAnimatorOptions()
                    {
                        From             = 0,
                        To               = panel.Width - 1,
                        Duration         = 3000,
                        Setter           = v => element.MoveTo(v, element.Top),
                        DelayProvider    = delayProvider,
                        AutoReverse      = true,
                        AutoReverseDelay = 1000,
                    });
                    panel.SpaceTime.Stop();
                    app.Stop();
                });
            });

            await app.Start();

            app.AssertThisTestMatchesLKG();
            Console.WriteLine(delayProvider.DelayCount + " delays");
            Console.WriteLine(app.TotalPaints + " paints");
            Console.WriteLine(app.TotalCycles + " cycles");
        }
Beispiel #3
0
 public KeyframeDelayProvider(CliTestHarness app)
 {
     this.app = app;
 }