Trying to figure out aboutbox issue

This commit is contained in:
Tig
2024-07-20 16:33:23 -06:00
parent 6f9fb1a68d
commit 6da8dab640
3 changed files with 75 additions and 46 deletions

View File

@@ -448,6 +448,13 @@ internal partial class TestHelpers
expectedLook = expectedLook [..^Environment.NewLine.Length];
}
// If test is about to fail show user what things looked like
if (!string.Equals (expectedLook, actualLook))
{
output?.WriteLine ("Expected:" + Environment.NewLine + expectedLook);
output?.WriteLine (" But Was:" + Environment.NewLine + actualLook);
}
Assert.Equal (expectedLook, actualLook);
return new (x > -1 ? x : 0, y > -1 ? y : 0, w > -1 ? w : 0, h > -1 ? h : 0);

View File

@@ -7195,25 +7195,14 @@ B ")]
#endregion
[Fact]
[SetupFakeDriver]
public void UICatalog_AboutBox_Text ()
{
StringBuilder _aboutMessage = new ();
_aboutMessage.AppendLine ($"UI Catalog: A comprehensive sample library for");
_aboutMessage.AppendLine (@"
_______ _ _ _____ _
|__ __| (_) | | / ____| (_)
| | ___ _ __ _ __ ___ _ _ __ __ _| || | __ _ _ _
| |/ _ \ '__| '_ ` _ \| | '_ \ / _` | || | |_ | | | | |
| | __/ | | | | | | | | | | | (_| | || |__| | |_| | |
|_|\___|_| |_| |_| |_|_|_| |_|\__,_|_(_)_____|\__,_|_|
");
_aboutMessage.AppendLine (@"v2 - Pre-Alpha");
_aboutMessage.AppendLine (@"");
_aboutMessage.AppendLine (@"https://github.com/gui-cs/Terminal.Gui");
TextFormatter tf = new ()
{
Text = _aboutMessage.ToString(),
Text = UICatalog.UICatalogApp.GetAboutBoxMessage (),
Alignment = Alignment.Center,
VerticalAlignment = Alignment.Start,
WordWrap = false,
MultiLine = true,
HotKeySpecifier = (Rune)0xFFFF
@@ -7221,5 +7210,29 @@ B ")]
Size tfSize = tf.FormatAndGetSize ();
Assert.Equal (new Size (58, 13), tfSize);
((FakeDriver)Application.Driver).SetBufferSize (tfSize.Width, tfSize.Height);
Application.Driver.FillRect (Application.Screen, (Rune)'*');
tf.Draw (Application.Screen, Attribute.Default, Attribute.Default);
string expectedText = """
******UI Catalog: A comprehensive sample library for******
**********************************************************
_______ _ _ _____ _*
|__ __| (_) | | / ____| (_)
| | ___ _ __ _ __ ___ _ _ __ __ _| || | __ _ _ _*
| |/ _ \ '__| '_ ` _ \| | '_ \ / _` | || | |_ | | | | |
| | __/ | | | | | | | | | | | (_| | || |__| | |_| | |
|_|\___|_| |_| |_| |_|_|_| |_|\__,_|_(_)_____|\__,_|_|
**********************************************************
**********************v2 - Pre-Alpha**********************
**********************************************************
**********https://github.com/gui-cs/Terminal.Gui**********
**********************************************************
""";
TestHelpers.AssertDriverContentsAre (expectedText, _output);
}
}