Fixes #2403. Dialog not draw text well if is opened on a smaller width.

This commit is contained in:
BDisp
2023-03-10 15:08:47 +00:00
committed by Tig
parent b949d78064
commit e69aa25ddd
4 changed files with 116 additions and 41 deletions

View File

@@ -157,7 +157,7 @@ namespace Terminal.Gui.TopLevelTests {
}
[Fact, AutoInitShutdown]
public void MessageBox_With_A_Label_Without_Spaces ()
public void MessageBox_With_A_Label_Without_Spaces_WrapMessagge_True ()
{
var iterations = -1;
Application.Begin (Application.Top);
@@ -196,8 +196,7 @@ namespace Terminal.Gui.TopLevelTests {
│ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff│
│ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff│
│ [◦ ok ◦] │
└──────────────────────────────────────────────────────────────────────────────┘
", output);
└──────────────────────────────────────────────────────────────────────────────┘", output);
Application.RequestStop ();
}
@@ -207,7 +206,7 @@ namespace Terminal.Gui.TopLevelTests {
}
[Fact, AutoInitShutdown]
public void MessageBox_With_A_Label_With_Spaces ()
public void MessageBox_With_A_Label_With_Spaces_WrapMessagge_True ()
{
var iterations = -1;
Application.Begin (Application.Top);
@@ -250,8 +249,69 @@ namespace Terminal.Gui.TopLevelTests {
│ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff │
│ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff │
│ [◦ ok ◦] │
└──────────────────────────────────────────────────────────────────────────────┘
", output);
└──────────────────────────────────────────────────────────────────────────────┘", output);
Application.RequestStop ();
}
};
Application.Run ();
}
[Fact, AutoInitShutdown]
public void MessageBox_With_A_Label_Without_Spaces_WrapMessagge_False ()
{
var iterations = -1;
Application.Begin (Application.Top);
Application.Iteration += () => {
iterations++;
if (iterations == 0) {
MessageBox.Query ("mywindow", new string ('f', 2000), 0, null, false, "ok");
Application.RequestStop ();
} else if (iterations == 1) {
Application.Refresh ();
TestHelpers.AssertDriverContentsWithFrameAre (@"
────────────────────────────────────────────────────────────────────────────────
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
[◦ ok ◦]
────────────────────────────────────────────────────────────────────────────────", output);
Application.RequestStop ();
}
};
Application.Run ();
}
[Fact, AutoInitShutdown]
public void MessageBox_With_A_Label_With_Spaces_WrapMessagge_False ()
{
var iterations = -1;
Application.Begin (Application.Top);
Application.Iteration += () => {
iterations++;
if (iterations == 0) {
var sb = new StringBuilder ();
for (int i = 0; i < 1000; i++)
sb.Append ("ff ");
MessageBox.Query ("mywindow", sb.ToString (), 0, null, false, "ok");
Application.RequestStop ();
} else if (iterations == 1) {
Application.Refresh ();
TestHelpers.AssertDriverContentsWithFrameAre (@"
────────────────────────────────────────────────────────────────────────────────
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff f
[◦ ok ◦]
────────────────────────────────────────────────────────────────────────────────", output);
Application.RequestStop ();
}