mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-01 16:59:35 +01:00
Fixing unit tests 4
This commit is contained in:
@@ -51,7 +51,7 @@ public class DialogTests
|
||||
// Now add a second button
|
||||
buttonRow = $"{CM.Glyphs.VLine} {btn1} {btn2} {CM.Glyphs.VLine}";
|
||||
dlg.AddButton (new () { Text = btn2Text });
|
||||
|
||||
|
||||
RunIteration (ref runstate);
|
||||
TestHelpers.AssertDriverContentsWithFrameAre ($"{buttonRow}", _output);
|
||||
End (runstate);
|
||||
@@ -160,7 +160,7 @@ public class DialogTests
|
||||
|
||||
|
||||
// Default - Center
|
||||
(runstate, Dialog dlg) = RunButtonTestDialog (
|
||||
(runstate, Dialog dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.Center,
|
||||
@@ -177,7 +177,7 @@ public class DialogTests
|
||||
buttonRow = $"{CM.Glyphs.VLine}{btn1} {btn2} {btn3} {btn4}{CM.Glyphs.VLine}";
|
||||
Assert.Equal (width, buttonRow.Length);
|
||||
|
||||
(runstate, dlg) = RunButtonTestDialog (
|
||||
(runstate, dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.Fill,
|
||||
@@ -194,7 +194,7 @@ public class DialogTests
|
||||
buttonRow = $"{CM.Glyphs.VLine} {btn1} {btn2} {btn3} {btn4}{CM.Glyphs.VLine}";
|
||||
Assert.Equal (width, buttonRow.Length);
|
||||
|
||||
(runstate, dlg) = RunButtonTestDialog (
|
||||
(runstate, dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.End,
|
||||
@@ -211,7 +211,7 @@ public class DialogTests
|
||||
buttonRow = $"{CM.Glyphs.VLine}{btn1} {btn2} {btn3} {btn4} {CM.Glyphs.VLine}";
|
||||
Assert.Equal (width, buttonRow.Length);
|
||||
|
||||
(runstate, dlg) = RunButtonTestDialog (
|
||||
(runstate, dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.Start,
|
||||
@@ -255,7 +255,7 @@ public class DialogTests
|
||||
buttonRow =
|
||||
$"{CM.Glyphs.VLine} yes {CM.Glyphs.RightBracket}{btn2}{btn3}{CM.Glyphs.LeftBracket} never{CM.Glyphs.VLine}";
|
||||
|
||||
(runstate, Dialog dlg) = RunButtonTestDialog (
|
||||
(runstate, Dialog dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.Center,
|
||||
@@ -273,7 +273,7 @@ public class DialogTests
|
||||
buttonRow =
|
||||
$"{CM.Glyphs.VLine}{CM.Glyphs.LeftBracket} yes {CM.Glyphs.LeftBracket} no {CM.Glyphs.LeftBracket} maybe {CM.Glyphs.LeftBracket} never {CM.Glyphs.RightBracket}{CM.Glyphs.VLine}";
|
||||
|
||||
(runstate, dlg) = RunButtonTestDialog (
|
||||
(runstate, dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.Fill,
|
||||
@@ -290,7 +290,7 @@ public class DialogTests
|
||||
buttonRow = $"{CM.Glyphs.VLine}es {CM.Glyphs.RightBracket}{btn2}{btn3}{btn4}{CM.Glyphs.VLine}";
|
||||
Assert.Equal (width, buttonRow.Length);
|
||||
|
||||
(runstate, dlg) = RunButtonTestDialog (
|
||||
(runstate, dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.End,
|
||||
@@ -306,7 +306,7 @@ public class DialogTests
|
||||
// Left
|
||||
buttonRow = $"{CM.Glyphs.VLine}{btn1}{btn2}{btn3}{CM.Glyphs.LeftBracket} neve{CM.Glyphs.VLine}";
|
||||
|
||||
(runstate, dlg) = RunButtonTestDialog (
|
||||
(runstate, dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.Start,
|
||||
@@ -349,7 +349,7 @@ public class DialogTests
|
||||
d.SetBufferSize (buttonRow.Length, 1);
|
||||
|
||||
// Default - Center
|
||||
(runstate, Dialog dlg) = RunButtonTestDialog (
|
||||
(runstate, Dialog dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.Center,
|
||||
@@ -366,7 +366,7 @@ public class DialogTests
|
||||
buttonRow = $"{CM.Glyphs.VLine}{btn1} {btn2} {btn3} {btn4}{CM.Glyphs.VLine}";
|
||||
Assert.Equal (width, buttonRow.Length);
|
||||
|
||||
(runstate, dlg) = RunButtonTestDialog (
|
||||
(runstate, dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.Fill,
|
||||
@@ -383,7 +383,7 @@ public class DialogTests
|
||||
buttonRow = $"{CM.Glyphs.VLine} {btn1} {btn2} {btn3} {btn4}{CM.Glyphs.VLine}";
|
||||
Assert.Equal (width, buttonRow.Length);
|
||||
|
||||
(runstate, dlg) = RunButtonTestDialog (
|
||||
(runstate, dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.End,
|
||||
@@ -400,7 +400,7 @@ public class DialogTests
|
||||
buttonRow = $"{CM.Glyphs.VLine}{btn1} {btn2} {btn3} {btn4} {CM.Glyphs.VLine}";
|
||||
Assert.Equal (width, buttonRow.Length);
|
||||
|
||||
(runstate, dlg) = RunButtonTestDialog (
|
||||
(runstate, dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.Start,
|
||||
@@ -445,7 +445,7 @@ public class DialogTests
|
||||
d.SetBufferSize (width, 3);
|
||||
|
||||
// Default - Center
|
||||
(runstate, Dialog dlg) = RunButtonTestDialog (
|
||||
(runstate, Dialog dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.Center,
|
||||
@@ -462,7 +462,7 @@ public class DialogTests
|
||||
buttonRow = $"{CM.Glyphs.VLine}{btn1} {btn2} {btn3} {btn4}{CM.Glyphs.VLine}";
|
||||
Assert.Equal (width, buttonRow.GetColumns ());
|
||||
|
||||
(runstate, dlg) = RunButtonTestDialog (
|
||||
(runstate, dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.Fill,
|
||||
@@ -479,7 +479,7 @@ public class DialogTests
|
||||
buttonRow = $"{CM.Glyphs.VLine} {btn1} {btn2} {btn3} {btn4}{CM.Glyphs.VLine}";
|
||||
Assert.Equal (width, buttonRow.GetColumns ());
|
||||
|
||||
(runstate, dlg) = RunButtonTestDialog (
|
||||
(runstate, dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.End,
|
||||
@@ -496,7 +496,7 @@ public class DialogTests
|
||||
buttonRow = $"{CM.Glyphs.VLine}{btn1} {btn2} {btn3} {btn4} {CM.Glyphs.VLine}";
|
||||
Assert.Equal (width, buttonRow.GetColumns ());
|
||||
|
||||
(runstate, dlg) = RunButtonTestDialog (
|
||||
(runstate, dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.Start,
|
||||
@@ -530,7 +530,7 @@ public class DialogTests
|
||||
|
||||
d.SetBufferSize (width, 1);
|
||||
|
||||
(runstate, Dialog dlg) = RunButtonTestDialog (
|
||||
(runstate, Dialog dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.Center,
|
||||
@@ -547,7 +547,7 @@ public class DialogTests
|
||||
$"{CM.Glyphs.VLine}{CM.Glyphs.LeftBracket} {btnText} {CM.Glyphs.RightBracket} {CM.Glyphs.VLine}";
|
||||
Assert.Equal (width, buttonRow.Length);
|
||||
|
||||
(runstate, dlg) = RunButtonTestDialog (
|
||||
(runstate, dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.Fill,
|
||||
@@ -562,7 +562,7 @@ public class DialogTests
|
||||
$"{CM.Glyphs.VLine} {CM.Glyphs.LeftBracket} {btnText} {CM.Glyphs.RightBracket}{CM.Glyphs.VLine}";
|
||||
Assert.Equal (width, buttonRow.Length);
|
||||
|
||||
(runstate, dlg) = RunButtonTestDialog (
|
||||
(runstate, dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.End,
|
||||
@@ -577,7 +577,7 @@ public class DialogTests
|
||||
$"{CM.Glyphs.VLine}{CM.Glyphs.LeftBracket} {btnText} {CM.Glyphs.RightBracket} {CM.Glyphs.VLine}";
|
||||
Assert.Equal (width, buttonRow.Length);
|
||||
|
||||
(runstate, dlg) = RunButtonTestDialog (
|
||||
(runstate, dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.Start,
|
||||
@@ -594,7 +594,7 @@ public class DialogTests
|
||||
|
||||
d.SetBufferSize (width, 1);
|
||||
|
||||
(runstate, dlg) = RunButtonTestDialog (
|
||||
(runstate, dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.Center,
|
||||
@@ -609,7 +609,7 @@ public class DialogTests
|
||||
$"{CM.Glyphs.VLine}{CM.Glyphs.LeftBracket} {btnText} {CM.Glyphs.RightBracket} {CM.Glyphs.VLine}";
|
||||
Assert.Equal (width, buttonRow.Length);
|
||||
|
||||
(runstate, dlg) = RunButtonTestDialog (
|
||||
(runstate, dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.Fill,
|
||||
@@ -624,7 +624,7 @@ public class DialogTests
|
||||
$"{CM.Glyphs.VLine} {CM.Glyphs.LeftBracket} {btnText} {CM.Glyphs.RightBracket}{CM.Glyphs.VLine}";
|
||||
Assert.Equal (width, buttonRow.Length);
|
||||
|
||||
(runstate, dlg) = RunButtonTestDialog (
|
||||
(runstate, dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.End,
|
||||
@@ -639,7 +639,7 @@ public class DialogTests
|
||||
$"{CM.Glyphs.VLine}{CM.Glyphs.LeftBracket} {btnText} {CM.Glyphs.RightBracket} {CM.Glyphs.VLine}";
|
||||
Assert.Equal (width, buttonRow.Length);
|
||||
|
||||
(runstate, dlg) = RunButtonTestDialog (
|
||||
(runstate, dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.Start,
|
||||
@@ -675,7 +675,7 @@ public class DialogTests
|
||||
|
||||
d.SetBufferSize (buttonRow.Length, 3);
|
||||
|
||||
(runstate, Dialog dlg) = RunButtonTestDialog (
|
||||
(runstate, Dialog dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.Center,
|
||||
@@ -691,7 +691,7 @@ public class DialogTests
|
||||
buttonRow = $@"{CM.Glyphs.VLine}{btn1} {btn2} {btn3}{CM.Glyphs.VLine}";
|
||||
Assert.Equal (width, buttonRow.Length);
|
||||
|
||||
(runstate, dlg) = RunButtonTestDialog (
|
||||
(runstate, dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.Fill,
|
||||
@@ -707,7 +707,7 @@ public class DialogTests
|
||||
buttonRow = $@"{CM.Glyphs.VLine} {btn1} {btn2} {btn3}{CM.Glyphs.VLine}";
|
||||
Assert.Equal (width, buttonRow.Length);
|
||||
|
||||
(runstate, dlg) = RunButtonTestDialog (
|
||||
(runstate, dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.End,
|
||||
@@ -723,7 +723,7 @@ public class DialogTests
|
||||
buttonRow = $@"{CM.Glyphs.VLine}{btn1} {btn2} {btn3} {CM.Glyphs.VLine}";
|
||||
Assert.Equal (width, buttonRow.Length);
|
||||
|
||||
(runstate, dlg) = RunButtonTestDialog (
|
||||
(runstate, dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.Start,
|
||||
@@ -759,7 +759,7 @@ public class DialogTests
|
||||
|
||||
d.SetBufferSize (buttonRow.Length, 3);
|
||||
|
||||
(runstate, Dialog dlg) = RunButtonTestDialog (
|
||||
(runstate, Dialog dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.Center,
|
||||
@@ -774,7 +774,7 @@ public class DialogTests
|
||||
buttonRow = $@"{CM.Glyphs.VLine}{btn1} {btn2}{CM.Glyphs.VLine}";
|
||||
Assert.Equal (width, buttonRow.Length);
|
||||
|
||||
(runstate, dlg) = RunButtonTestDialog (
|
||||
(runstate, dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.Fill,
|
||||
@@ -789,7 +789,7 @@ public class DialogTests
|
||||
buttonRow = $@"{CM.Glyphs.VLine} {btn1} {btn2}{CM.Glyphs.VLine}";
|
||||
Assert.Equal (width, buttonRow.Length);
|
||||
|
||||
(runstate, dlg) = RunButtonTestDialog (
|
||||
(runstate, dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.End,
|
||||
@@ -804,7 +804,7 @@ public class DialogTests
|
||||
buttonRow = $@"{CM.Glyphs.VLine}{btn1} {btn2} {CM.Glyphs.VLine}";
|
||||
Assert.Equal (width, buttonRow.Length);
|
||||
|
||||
(runstate, dlg) = RunButtonTestDialog (
|
||||
(runstate, dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.Start,
|
||||
@@ -846,7 +846,7 @@ public class DialogTests
|
||||
// Default (Center)
|
||||
button1 = new Button { Text = btn1Text };
|
||||
button2 = new Button { Text = btn2Text };
|
||||
(runstate, dlg) = RunButtonTestDialog (title, width, Alignment.Center, button1, button2);
|
||||
(runstate, dlg) = BeginButtonTestDialog (title, width, Alignment.Center, button1, button2);
|
||||
button1.Visible = false;
|
||||
RunIteration (ref runstate, firstIteration);
|
||||
buttonRow = $@"{CM.Glyphs.VLine} {btn2} {CM.Glyphs.VLine}";
|
||||
@@ -858,7 +858,7 @@ public class DialogTests
|
||||
Assert.Equal (width, buttonRow.Length);
|
||||
button1 = new Button { Text = btn1Text };
|
||||
button2 = new Button { Text = btn2Text };
|
||||
(runstate, dlg) = RunButtonTestDialog (title, width, Alignment.Fill, button1, button2);
|
||||
(runstate, dlg) = BeginButtonTestDialog (title, width, Alignment.Fill, button1, button2);
|
||||
button1.Visible = false;
|
||||
RunIteration (ref runstate, firstIteration);
|
||||
buttonRow = $@"{CM.Glyphs.VLine} {btn2}{CM.Glyphs.VLine}";
|
||||
@@ -870,7 +870,7 @@ public class DialogTests
|
||||
Assert.Equal (width, buttonRow.Length);
|
||||
button1 = new Button { Text = btn1Text };
|
||||
button2 = new Button { Text = btn2Text };
|
||||
(runstate, dlg) = RunButtonTestDialog (title, width, Alignment.End, button1, button2);
|
||||
(runstate, dlg) = BeginButtonTestDialog (title, width, Alignment.End, button1, button2);
|
||||
button1.Visible = false;
|
||||
RunIteration (ref runstate, firstIteration);
|
||||
TestHelpers.AssertDriverContentsWithFrameAre ($"{buttonRow}", _output);
|
||||
@@ -881,7 +881,7 @@ public class DialogTests
|
||||
Assert.Equal (width, buttonRow.Length);
|
||||
button1 = new Button { Text = btn1Text };
|
||||
button2 = new Button { Text = btn2Text };
|
||||
(runstate, dlg) = RunButtonTestDialog (title, width, Alignment.Start, button1, button2);
|
||||
(runstate, dlg) = BeginButtonTestDialog (title, width, Alignment.Start, button1, button2);
|
||||
button1.Visible = false;
|
||||
RunIteration (ref runstate, firstIteration);
|
||||
buttonRow = $@"{CM.Glyphs.VLine} {btn2} {CM.Glyphs.VLine}";
|
||||
@@ -1323,7 +1323,7 @@ public class DialogTests
|
||||
int width = buttonRow.Length;
|
||||
d.SetBufferSize (buttonRow.Length, 10);
|
||||
|
||||
(runstate, Dialog dlg) = RunButtonTestDialog (
|
||||
(runstate, Dialog dlg) = BeginButtonTestDialog (
|
||||
title,
|
||||
width,
|
||||
Alignment.Center,
|
||||
@@ -1382,14 +1382,15 @@ public class DialogTests
|
||||
int width = buttonRow.Length;
|
||||
d.SetBufferSize (buttonRow.Length, 3);
|
||||
|
||||
(runstate, Dialog dlg) = RunButtonTestDialog (title, width, Alignment.Center, null);
|
||||
(runstate, Dialog dlg) = BeginButtonTestDialog (title, width, Alignment.Center, null);
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre ($"{buttonRow}", _output);
|
||||
|
||||
End (runstate);
|
||||
dlg.Dispose ();
|
||||
}
|
||||
|
||||
private (RunState, Dialog) RunButtonTestDialog (
|
||||
private (RunState, Dialog) BeginButtonTestDialog (
|
||||
string title,
|
||||
int width,
|
||||
Alignment align,
|
||||
@@ -1416,7 +1417,14 @@ public class DialogTests
|
||||
// Create with no top or bottom border to simplify testing button layout (no need to account for title etc..)
|
||||
dlg.Border.Thickness = new (1, 0, 1, 0);
|
||||
|
||||
return (Begin (dlg), dlg);
|
||||
RunState runState = Begin (dlg);
|
||||
|
||||
dlg.SetNeedsDisplay();
|
||||
dlg.SetLayoutNeeded ();
|
||||
dlg.Layout ();
|
||||
dlg.Draw ();
|
||||
|
||||
return (runState, dlg);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user