Esempio n. 1
0
        public void RenderChartTestCommon(XYChartOptions options, int w = 80, int h = 30)
        {
            var app = new CliTestHarness(this.TestContext, w, h, true);

            app.InvokeNextCycle(() => app.LayoutRoot.Add(new XYChart(options)).Fill());
            app.InvokeNextCycle(async() =>
            {
                await app.Paint();
                app.RecordKeyFrame();
                app.Stop();
            });
            app.Start().Wait();
            app.AssertThisTestMatchesLKG();
        }
Esempio n. 2
0
        public void ShowTextInput()
        {
            var app = new CliTestHarness(this.TestContext, 80, 20, true);

            app.InvokeNextCycle(async() =>
            {
                Task <ConsoleString> dialogTask;
                dialogTask = Dialog.ShowRichTextInput(new RichTextDialogOptions()
                {
                    Message = "Rich text input prompt text".ToGreen(),
                });
                await app.PaintAndRecordKeyFrameAsync();
                Assert.IsFalse(dialogTask.IsFulfilled());
                app.SendKey(new ConsoleKeyInfo('A', ConsoleKey.A, false, false, false));
                await app.PaintAndRecordKeyFrameAsync();
                app.SendKey(new ConsoleKeyInfo('d', ConsoleKey.D, false, false, false));
                await app.PaintAndRecordKeyFrameAsync();
                app.SendKey(new ConsoleKeyInfo('a', ConsoleKey.A, false, false, false));
                await app.PaintAndRecordKeyFrameAsync();
                app.SendKey(new ConsoleKeyInfo('m', ConsoleKey.M, false, false, false));
                await app.PaintAndRecordKeyFrameAsync();
                Assert.IsFalse(dialogTask.IsFulfilled());
                app.SendKey(new ConsoleKeyInfo(' ', ConsoleKey.Enter, false, false, false));
                var stringVal = (await dialogTask).ToString();
                await app.Paint();
                app.RecordKeyFrame();
                Assert.AreEqual("Adam", stringVal);
                app.Stop();
            });

            app.Start().Wait();
            app.AssertThisTestMatchesLKG();
        }
Esempio n. 3
0
        public void ShowEnumOptions()
        {
            var app = new CliTestHarness(this.TestContext, 80, 20, true);

            app.InvokeNextCycle(async() =>
            {
                Task <ConsoleColor?> dialogTask;
                dialogTask = Dialog.ShowEnumOptions <ConsoleColor>("Enum option picker".ToGreen());
                await app.PaintAndRecordKeyFrameAsync();
                Assert.IsFalse(dialogTask.IsFulfilled());

                for (var i = 0; i < 6; i++)
                {
                    app.SendKey(new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, false, false, false));
                    await app.PaintAndRecordKeyFrameAsync();
                }

                app.SendKey(new ConsoleKeyInfo(' ', ConsoleKey.Enter, false, false, false));
                await app.PaintAndRecordKeyFrameAsync();

                var enumValue = (await dialogTask);
                Assert.AreEqual(ConsoleColor.DarkGreen, enumValue);
                app.Stop();
            });

            app.Start().Wait();
            app.AssertThisTestMatchesLKG();
        }
Esempio n. 4
0
        public void TestFixedAspectRatio()
        {
            var app = new CliTestHarness(this.TestContext, 130, 40, true);

            app.SecondsBetweenKeyframes = .05f;
            app.InvokeNextCycle(async() =>
            {
                var fixedPanel = app.LayoutRoot.Add(new FixedAspectRatioPanel(2, new ConsolePanel()
                {
                    Background = RGB.Green
                })).CenterBoth();
                app.LayoutRoot.Background = RGB.DarkYellow;
                fixedPanel.Background     = RGB.Red;
                fixedPanel.Width          = app.LayoutRoot.Width;
                fixedPanel.Height         = app.LayoutRoot.Height;
                await app.PaintAndRecordKeyFrameAsync();

                while (fixedPanel.Width > 2)
                {
                    fixedPanel.Width -= 2;
                    await app.PaintAndRecordKeyFrameAsync();
                }

                app.Stop();
            });
            app.Start().Wait();
            app.AssertThisTestMatchesLKG();
        }
Esempio n. 5
0
        public void TestMonthCalendarBasicRender()
        {
            var app = new CliTestHarness(this.TestContext, MonthCalendar.MinWidth, MonthCalendar.MinHeight, true);

            app.InvokeNextCycle(() => app.LayoutRoot.Add(new MonthCalendar(new MonthCalendarOptions()
            {
                Year = 2000, Month = 1
            })).Fill());
            app.InvokeNextCycle(async() =>
            {
                await app.RequestPaintAsync();
                app.RecordKeyFrame();
                app.Stop();
            });
            app.Start().Wait();
            app.AssertThisTestMatchesLKG();
        }
Esempio n. 6
0
        public void TestScrollableContentBasic()
        {
            var app = new CliTestHarness(this.TestContext, 80, 10, true);

            app.SecondsBetweenKeyframes = .1f;
            app.LayoutRoot.Background   = RGB.Red;
            app.InvokeNextCycle(async() =>
            {
                // We want to have a stack panel that can scroll if it gets too bit

                // Step 1 - Create a scroll panel and size it how you like
                var scrollPanel = app.LayoutRoot.Add(new ScrollablePanel()
                {
                    Background = RGB.DarkBlue
                }).Fill();

                // Step 2 - Add scrollable content to the ScrollableContent container
                var stack = scrollPanel.ScrollableContent.Add(new StackPanel()
                {
                    Background = RGB.Yellow, AutoSize = true
                });

                // IMPORTANT - The ScrollableContent container is the thing that will scroll if it's bigger than the view
                //             so make sure it's height gets bigger as its content grows.
                stack.SubscribeForLifetime(nameof(stack.Bounds), () => scrollPanel.ScrollableContent.Height = stack.Height, stack);

                // Step 3 - Add 100 focusable rows to the stack panel. Making the rows focusable is critical since
                //          the scroll panel will automatically take care of scrolling to the currently focused control
                //          if that control is within the ScrollableContent.
                var rows = 100;
                for (var i = 1; i <= rows; i++)
                {
                    var label = stack.Add(new Label()
                    {
                        CanFocus = true, Text = $"row {i} of {rows}".ToWhite()
                    });
                    label.Focused.SubscribeForLifetime(() => label.Text = label.Text.ToCyan(), label);
                    label.Focused.SubscribeForLifetime(() => label.Text = label.Text.ToWhite(), label);
                }

                // Step 4 - Tab through all the rows. The scrollbar and scrollable content should automatically
                //        - keep the focused row in view.
                for (var i = 0; i < rows; i++)
                {
                    app.SendKey(new ConsoleKeyInfo('\t', ConsoleKey.Tab, false, false, false));
                    await app.PaintAndRecordKeyFrameAsync();
                }
                app.Stop();
            });

            app.Start().Wait();
            app.AssertThisTestMatchesLKG();
        }
Esempio n. 7
0
        public void TestPlaybackEndToEnd()
        {
            int w = 10, h = 1;
            var temp = Path.GetTempFileName();

            using (var stream = File.OpenWrite(temp))
            {
                var writer = new ConsoleBitmapStreamWriter(stream)
                {
                    CloseInnerStream = false
                };
                var bitmap = new ConsoleBitmap(w, h);

                for (var i = 0; i < bitmap.Width; i++)
                {
                    bitmap.Pen = new ConsoleCharacter(' ');
                    bitmap.FillRectUnsafe(0, 0, bitmap.Width, bitmap.Height);
                    bitmap.Pen = new ConsoleCharacter(' ', backgroundColor: ConsoleColor.Red);
                    bitmap.DrawPoint(i, 0);
                    writer.WriteFrame(bitmap, true, TimeSpan.FromSeconds(.5 * i));
                }
                writer.Dispose();
            }

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

            app.InvokeNextCycle(() =>
            {
                var player = app.LayoutRoot.Add(new ConsoleBitmapPlayer()).Fill();
                player.Load(File.OpenRead(temp));
                app.SetTimeout(() => app.SendKey(new ConsoleKeyInfo('p', ConsoleKey.P, false, false, false)), TimeSpan.FromMilliseconds(100));
                var playStarted = false;
                player.SubscribeForLifetime(nameof(player.State), () =>
                {
                    if (player.State == PlayerState.Playing)
                    {
                        playStarted = true;
                    }
                    else if (player.State == PlayerState.Stopped && playStarted)
                    {
                        app.Stop();
                    }
                }, app);
            });

            app.Start().Wait();
            Thread.Sleep(100);
            app.AssertThisTestMatchesLKGFirstAndLastFrame();
        }
Esempio n. 8
0
        public void TestPlaybackEndToEnd()
        {
            var app = new CliTestHarness(this.TestContext, 80, 30);

            app.InvokeNextCycle(async() =>
            {
                int w    = 10, h = 1;
                var temp = Path.GetTempFileName();
                using (var stream = File.OpenWrite(temp))
                {
                    var writer = new ConsoleBitmapVideoWriter(s => stream.Write(Encoding.Default.GetBytes(s)));
                    var bitmap = new ConsoleBitmap(w, h);

                    for (var i = 0; i < bitmap.Width; i++)
                    {
                        bitmap.Fill(new ConsoleCharacter(' '));
                        bitmap.DrawPoint(new ConsoleCharacter(' ', backgroundColor: ConsoleColor.Red), i, 0);
                        writer.WriteFrame(bitmap, true, TimeSpan.FromSeconds(.1 * i));
                    }
                    writer.Finish();
                }

                var player = app.LayoutRoot.Add(new ConsoleBitmapPlayer()).Fill();
                Assert.IsFalse(player.Width == 0);
                Assert.IsFalse(player.Height == 0);
                player.Load(File.OpenRead(temp));

                var playStarted = false;
                player.SubscribeForLifetime(nameof(player.State), () =>
                {
                    if (player.State == PlayerState.Playing)
                    {
                        playStarted = true;
                    }
                    else if (player.State == PlayerState.Stopped && playStarted)
                    {
                        app.Stop();
                    }
                }, app);

                await Task.Delay(100);
                await app.SendKey(new ConsoleKeyInfo('p', ConsoleKey.P, false, false, false));
            });

            app.Start().Wait();
            Thread.Sleep(100);
            app.AssertThisTestMatchesLKGFirstAndLastFrame();
        }
Esempio n. 9
0
        public void TestRenderTextBox()
        {
            var app = new CliTestHarness(this.TestContext, 9, 1);

            app.InvokeNextCycle(async() =>
            {
                app.LayoutRoot.Add(new TextBox()
                {
                    Value = "SomeText".ToWhite()
                }).Fill();
                await app.RequestPaintAsync();
                Assert.IsTrue(app.Find("SomeText".ToWhite()).HasValue);
                app.Stop();
            });

            app.Start().Wait();
            app.AssertThisTestMatchesLKG();
        }
Esempio n. 10
0
        public void ShowYesConfirmation()
        {
            var app = new CliTestHarness(this.TestContext, 80, 20, true);

            app.InvokeNextCycle(async() =>
            {
                Task dialogTask;

                dialogTask = Dialog.ShowYesConfirmation("Yes or no, no will be clicked");
                await app.PaintAndRecordKeyFrameAsync();
                Assert.IsFalse(dialogTask.IsFulfilled());

                var noRejected = false;
                dialogTask.Fail((ex) => noRejected = true);

                // simulate an enter keypress, which should clear the dialog, but should not trigger
                // the Task to resolve since yes was not chosen
                app.SendKey(new ConsoleKeyInfo(' ', ConsoleKey.Enter, false, false, false));
                await app.PaintAndRecordKeyFrameAsync();
                Assert.IsTrue(dialogTask.IsFulfilled());
                Assert.IsTrue(noRejected); // the Task should reject on no

                dialogTask = Dialog.ShowYesConfirmation("Yes or no, yes will be clicked");
                await app.PaintAndRecordKeyFrameAsync();
                Assert.IsFalse(dialogTask.IsFulfilled());
                // give focus to the yes option
                app.SendKey(new ConsoleKeyInfo('\t', ConsoleKey.Tab, true, false, false));
                await app.PaintAndRecordKeyFrameAsync();

                // dismiss the dialog
                app.SendKey(new ConsoleKeyInfo(' ', ConsoleKey.Enter, false, false, false));
                await app.PaintAndRecordKeyFrameAsync();
                await dialogTask;
                app.Stop();
            });

            app.Start().Wait();
            app.AssertThisTestMatchesLKG();
        }
Esempio n. 11
0
        public void TestDrawRect()
        {
            var bitmap = new ConsoleBitmap(80, 30);
            var app    = new CliTestHarness(TestContext, bitmap.Width, bitmap.Height, true);

            app.InvokeNextCycle(async() =>
            {
                app.LayoutRoot.Add(new BitmapControl()
                {
                    Bitmap = bitmap
                }).Fill();
                var pen = new ConsoleCharacter('X', ConsoleColor.Green);
                for (var i = 0; i < 500000; i++)
                {
                    bitmap.DrawRect(pen, 0, 0, bitmap.Width, bitmap.Height);
                }
                await app.PaintAndRecordKeyFrameAsync();
                app.Stop();
            });

            app.Start().Wait();
            app.AssertThisTestMatchesLKG();
        }
Esempio n. 12
0
        public async Task TestNormalizedProximity()
        {
            var app = new CliTestHarness(TestContext, 40, 40, true);

            app.InvokeNextCycle(async() =>
            {
                var a = app.LayoutRoot.Add(new ConsoleControl()
                {
                    Background = ConsoleColor.Red, Width = 1, Height = 1, X = 0, Y = 0
                });
                var b = app.LayoutRoot.Add(new ConsoleControl()
                {
                    Background = ConsoleColor.Green, Width = 1, Height = 1, X = 39, Y = 39
                });
                var d = Geometry.CalculateNormalizedDistanceTo(a, b);
                Console.WriteLine(d);
                await app.PaintAndRecordKeyFrameAsync();
                app.Stop();
            });

            await app.Start();

            app.AssertThisTestMatchesLKG();
        }
Esempio n. 13
0
        public void ShowMessageBasicString()
        {
            var app = new CliTestHarness(this.TestContext, 80, 20, true);

            app.InvokeNextCycle(async() =>
            {
                Task dialogTask;

                // show hello world message, wait for a paint, then take a keyframe of the screen, which
                // should have the dialog shown
                dialogTask = Dialog.ShowMessage("Hello world");
                await app.PaintAndRecordKeyFrameAsync();
                Assert.IsFalse(dialogTask.IsFulfilled());

                // simulate an enter keypress, which should clear the dialog
                app.SendKey(new ConsoleKeyInfo(' ', ConsoleKey.Enter, false, false, false));
                await app.PaintAndRecordKeyFrameAsync();
                await dialogTask;
                app.Stop();
            });

            app.Start().Wait();
            app.AssertThisTestMatchesLKG();
        }
Esempio n. 14
0
        public void TestMonthCalendarFocusAndNav()
        {
            var app = new CliTestHarness(this.TestContext, MonthCalendar.MinWidth, MonthCalendar.MinHeight, true);

            app.InvokeNextCycle(async() =>
            {
                var calendar = app.LayoutRoot.Add(new MonthCalendar(new MonthCalendarOptions()
                {
                    Year = 2000, Month = 1
                })).Fill();
                await app.PaintAndRecordKeyFrameAsync();
                calendar.TryFocus();
                await app.PaintAndRecordKeyFrameAsync();
                var fwInfo   = new ConsoleKeyInfo('a', calendar.Options.AdvanceMonthForwardKey.Key, false, false, false);
                var backInfo = new ConsoleKeyInfo('b', calendar.Options.AdvanceMonthBackwardKey.Key, false, false, false);
                await app.SendKey(backInfo);
                await app.PaintAndRecordKeyFrameAsync();
                await app.SendKey(fwInfo);
                await app.PaintAndRecordKeyFrameAsync();
                app.Stop();
            });
            app.Start().Wait();
            app.AssertThisTestMatchesLKG();
        }
Esempio n. 15
0
        public void TestDataGridBasic()
        {
            var items = new List <Item>();

            for (var i = 0; i < 100; i++)
            {
                items.Add(new Item()
                {
                    Bar = "Bar" + i,
                    Foo = "Foo" + i,
                });
            }

            var app = new CliTestHarness(TestContext, 80, 20, true)
            {
                SecondsBetweenKeyframes = .05
            };

            var dataGrid = new ListGrid <Item>(new ListGridOptions <Item>()
            {
                DataSource = new SyncList <Item>(items),
                Columns    = new List <ListGridColumnDefinition <Item> >()
                {
                    new ListGridColumnDefinition <Item>()
                    {
                        Header    = "Foo".ToGreen(),
                        Width     = .5,
                        Type      = GridValueType.Percentage,
                        Formatter = (item) => new Label()
                        {
                            Text = item.Foo.ToConsoleString()
                        }
                    },
                    new ListGridColumnDefinition <Item>()
                    {
                        Header    = "Bar".ToRed(),
                        Width     = .5,
                        Type      = GridValueType.Percentage,
                        Formatter = (item) => new Label()
                        {
                            Text = item.Bar.ToConsoleString()
                        }
                    }
                }
            });

            app.InvokeNextCycle(async() =>
            {
                var selectionLabel = app.LayoutRoot.Add(new Label()
                {
                    Text = "DEFAULT".ToConsoleString(), Height = 1
                }).CenterHorizontally();
                selectionLabel.Text = $"SelectedRowIndex: {dataGrid.SelectedRowIndex}, SelectedCellIndex: {dataGrid.SelectedColumnIndex}".ToConsoleString();
                dataGrid.SelectionChanged.SubscribeForLifetime(() =>
                {
                    selectionLabel.Text = $"SelectedRowIndex: {dataGrid.SelectedRowIndex}, SelectedCellIndex: {dataGrid.SelectedColumnIndex}".ToConsoleString();
                }, dataGrid);
                app.LayoutRoot.Add(dataGrid).Fill(padding: new Thickness(0, 0, 1, 0));
                await app.PaintAndRecordKeyFrameAsync();

                for (var i = 0; i < items.Count - 1; i++)
                {
                    await app.SendKey(new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, false, false, false));
                    await app.PaintAndRecordKeyFrameAsync();
                }

                for (var i = 0; i < items.Count - 1; i++)
                {
                    await app.SendKey(new ConsoleKeyInfo(' ', ConsoleKey.UpArrow, false, false, false));
                    await app.PaintAndRecordKeyFrameAsync();
                }
                app.Stop();
            });

            app.Start().Wait();
            app.AssertThisTestMatchesLKG();
        }
Esempio n. 16
0
        public void GridLayoutEndToEnd()
        {
            var app = new CliTestHarness(this.TestContext, 80, 20, true);

            app.InvokeNextCycle(async() =>
            {
                var gridLayout = app.LayoutRoot.Add(new GridLayout(new GridLayoutOptions()
                {
                    Columns = new List <GridColumnDefinition>()
                    {
                        new GridColumnDefinition()
                        {
                            Width = 5, Type = GridValueType.Pixels
                        },
                        new GridColumnDefinition()
                        {
                            Width = 2, Type = GridValueType.RemainderValue
                        },
                        new GridColumnDefinition()
                        {
                            Width = 2, Type = GridValueType.RemainderValue
                        },
                    },
                    Rows = new List <GridRowDefinition>()
                    {
                        new GridRowDefinition()
                        {
                            Height = 1, Type = GridValueType.Pixels
                        },
                        new GridRowDefinition()
                        {
                            Height = 2, Type = GridValueType.RemainderValue
                        },
                        new GridRowDefinition()
                        {
                            Height = 1, Type = GridValueType.Pixels
                        },
                    }
                })).Fill();

                var colorWheel = new List <ConsoleColor>()
                {
                    ConsoleColor.Red, ConsoleColor.DarkRed, ConsoleColor.Red,
                    ConsoleColor.Black, ConsoleColor.White, ConsoleColor.Black,
                    ConsoleColor.Green, ConsoleColor.DarkGreen, ConsoleColor.Green
                };
                var colorIndex = 0;
                for (var y = 0; y < gridLayout.NumRows; y++)
                {
                    for (var x = 0; x < gridLayout.NumColumns; x++)
                    {
                        gridLayout.Add(new ConsoleControl()
                        {
                            Background = colorWheel[colorIndex],
                        }, x, y);
                        colorIndex = colorIndex == colorWheel.Count - 1 ? 0 : colorIndex + 1;
                    }
                }

                await app.RequestPaintAsync();
                app.RecordKeyFrame();
                app.Stop();
            });

            app.Start().Wait();
            app.AssertThisTestMatchesLKG();
        }
Esempio n. 17
0
        public static async Task Test(int w, int h, TestContext testContext, Func <CliTestHarness, SpaceTimePanel, Task> test)
        {
            Exception stEx = null;
            var       app  = new CliTestHarness(testContext, w, h, true);

            app.SecondsBetweenKeyframes = DefaultTimeIncrement.TotalSeconds;
            app.InvokeNextCycle(async() =>
            {
                var d = new TaskCompletionSource <bool>();
                var spaceTimePanel = app.LayoutRoot.Add(new SpaceTimePanel(app.LayoutRoot.Width, app.LayoutRoot.Height));
                spaceTimePanel.SpaceTime.Increment = DefaultTimeIncrement;
                var stTask = spaceTimePanel.SpaceTime.Start();


                var justUpdated = false;
                spaceTimePanel.AfterUpdate.SubscribeForLifetime(() => justUpdated = true, app);

                app.AfterPaint.SubscribeForLifetime(() =>
                {
                    if (justUpdated)
                    {
                        app.RecordKeyFrame();
                        justUpdated = false;
                    }
                }, app);

                spaceTimePanel.SpaceTime.InvokeNextCycle(async() =>
                {
                    spaceTimePanel.RealTimeViewing.Enabled = false;
                    try
                    {
                        await test(app, spaceTimePanel);
                    }
                    catch (Exception ex)
                    {
                        stEx = ex;
                    }

                    await app.Paint();
                    d.SetResult(true);
                });

                await d.Task;
                try
                {
                    await stTask;
                }catch (Exception exc)
                {
                    spaceTimePanel.SpaceTime.Stop();
                    d.SetResult(true);
                    stEx = exc;
                }
                await spaceTimePanel.SpaceTime.YieldAsync();
                await app.PaintAndRecordKeyFrameAsync();
                spaceTimePanel.SpaceTime.Stop();

                await app.PaintAndRecordKeyFrameAsync();
                app.Stop();
            });

            await app.Start();

            if (stEx != null)
            {
                app.Abandon();
                Assert.Fail(stEx.ToString());
            }
            else
            {
                app.PromoteToLKG();
            }
        }
Esempio n. 18
0
        public void DrawLines()
        {
            var bitmap  = new ConsoleBitmap(80, 30);
            var centerX = bitmap.Width / 2;
            var centerY = bitmap.Height / 2;

            var app = new CliTestHarness(TestContext, bitmap.Width, bitmap.Height, true);

            app.InvokeNextCycle(async() =>
            {
                app.LayoutRoot.Add(new BitmapControl()
                {
                    Bitmap = bitmap
                }).Fill();
                await app.RequestPaintAsync();
                app.RecordKeyFrame();

                bitmap.DrawLine(new ConsoleCharacter('X', ConsoleColor.Gray), centerX, centerY, 0, centerY / 2);
                await app.RequestPaintAsync();
                app.RecordKeyFrame();

                bitmap.DrawLine(new ConsoleCharacter('X', ConsoleColor.Red), centerX, centerY, 0, 0);
                await app.RequestPaintAsync();
                app.RecordKeyFrame();

                bitmap.DrawLine(new ConsoleCharacter('X', ConsoleColor.Yellow), centerX, centerY, centerX / 2, 0);
                await app.RequestPaintAsync();
                app.RecordKeyFrame();

                bitmap.DrawLine(new ConsoleCharacter('X', ConsoleColor.Green), centerX, centerY, centerX, 0);
                await app.RequestPaintAsync();
                app.RecordKeyFrame();

                bitmap.DrawLine(new ConsoleCharacter('X', ConsoleColor.Magenta), centerX, centerY, (int)(bitmap.Width * .75), 0);
                await app.RequestPaintAsync();
                app.RecordKeyFrame();

                bitmap.DrawLine(new ConsoleCharacter('X', ConsoleColor.Cyan), centerX, centerY, bitmap.Width - 1, 0);
                await app.RequestPaintAsync();
                app.RecordKeyFrame();

                bitmap.DrawLine(new ConsoleCharacter('X', ConsoleColor.Gray), centerX, centerY, bitmap.Width - 1, centerY / 2);
                await app.RequestPaintAsync();
                app.RecordKeyFrame();

                bitmap.DrawLine(new ConsoleCharacter('X', ConsoleColor.White), centerX, centerY, 0, bitmap.Height / 2);
                await app.RequestPaintAsync();
                app.RecordKeyFrame();

                bitmap.DrawLine(new ConsoleCharacter('X', ConsoleColor.Blue), centerX, centerY, bitmap.Width - 1, bitmap.Height / 2);
                await app.RequestPaintAsync();
                app.RecordKeyFrame();

                bitmap.DrawLine(new ConsoleCharacter('X', ConsoleColor.Gray), centerX, centerY, 0, (int)(bitmap.Height * .75));
                await app.RequestPaintAsync();
                app.RecordKeyFrame();

                bitmap.DrawLine(new ConsoleCharacter('X', ConsoleColor.Red), centerX, centerY, 0, bitmap.Height - 1);
                await app.RequestPaintAsync();
                app.RecordKeyFrame();

                bitmap.DrawLine(new ConsoleCharacter('X', ConsoleColor.Yellow), centerX, centerY, centerX / 2, bitmap.Height - 1);
                await app.RequestPaintAsync();
                app.RecordKeyFrame();

                bitmap.DrawLine(new ConsoleCharacter('X', ConsoleColor.Green), centerX, centerY, centerX, bitmap.Height - 1);
                await app.RequestPaintAsync();
                app.RecordKeyFrame();

                bitmap.DrawLine(new ConsoleCharacter('X', ConsoleColor.Magenta), centerX, centerY, (int)(bitmap.Width * .75), bitmap.Height - 1);
                await app.RequestPaintAsync();
                app.RecordKeyFrame();

                bitmap.DrawLine(new ConsoleCharacter('X', ConsoleColor.Cyan), centerX, centerY, bitmap.Width - 1, bitmap.Height - 1);
                await app.RequestPaintAsync();
                app.RecordKeyFrame();

                bitmap.DrawLine(new ConsoleCharacter('X', ConsoleColor.Gray), centerX, centerY, bitmap.Width - 1, (int)(bitmap.Height * .75));

                await app.RequestPaintAsync();
                app.RecordKeyFrame();
                app.Stop();
            });

            app.Start().Wait();
            app.AssertThisTestMatchesLKG();
        }