mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Made unit tests more resiliant to config changes
This commit is contained in:
@@ -26,6 +26,10 @@ public class DialogTests
|
||||
int width = $@"{CM.Glyphs.VLine} {btn1} {btn2} {CM.Glyphs.VLine}".Length;
|
||||
d.SetBufferSize (width, 1);
|
||||
|
||||
// Override CM
|
||||
Dialog.DefaultButtonAlignment = Alignment.Center;
|
||||
Dialog.DefaultBorderStyle = LineStyle.Single;
|
||||
|
||||
// Default (center)
|
||||
var dlg = new Dialog
|
||||
{
|
||||
@@ -151,6 +155,7 @@ public class DialogTests
|
||||
int width = buttonRow.Length;
|
||||
d.SetBufferSize (buttonRow.Length, 3);
|
||||
|
||||
|
||||
// Default - Center
|
||||
(runstate, Dialog dlg) = RunButtonTestDialog (
|
||||
title,
|
||||
@@ -874,6 +879,11 @@ public class DialogTests
|
||||
{
|
||||
((FakeDriver)Driver).SetBufferSize (20, 5);
|
||||
|
||||
// Override CM
|
||||
Window.DefaultBorderStyle = LineStyle.Single;
|
||||
Dialog.DefaultButtonAlignment = Alignment.Center;
|
||||
Dialog.DefaultBorderStyle = LineStyle.Single;
|
||||
|
||||
var win = new Window ();
|
||||
|
||||
var iterations = 0;
|
||||
@@ -889,7 +899,6 @@ public class DialogTests
|
||||
|
||||
win.Loaded += (s, a) =>
|
||||
{
|
||||
Dialog.DefaultButtonAlignment = Alignment.Center;
|
||||
var dlg = new Dialog { Width = 18, Height = 3, Buttons = [new () { Text = "Ok" }] };
|
||||
|
||||
dlg.Loaded += (s, a) =>
|
||||
@@ -975,7 +984,10 @@ public class DialogTests
|
||||
var win = new Window ();
|
||||
|
||||
int iterations = -1;
|
||||
|
||||
// Override CM
|
||||
Dialog.DefaultButtonAlignment = Alignment.Center;
|
||||
Dialog.DefaultBorderStyle = LineStyle.Single;
|
||||
|
||||
Iteration += (s, a) =>
|
||||
{
|
||||
@@ -1012,7 +1024,10 @@ public class DialogTests
|
||||
public void Dialog_Opened_From_Another_Dialog ()
|
||||
{
|
||||
((FakeDriver)Driver).SetBufferSize (30, 10);
|
||||
|
||||
// Override CM
|
||||
Dialog.DefaultButtonAlignment = Alignment.Center;
|
||||
Dialog.DefaultBorderStyle = LineStyle.Single;
|
||||
|
||||
var btn1 = new Button { Text = "press me 1" };
|
||||
Button btn2 = null;
|
||||
@@ -1159,6 +1174,11 @@ public class DialogTests
|
||||
[AutoInitShutdown]
|
||||
public void Location_When_Application_Top_Not_Default ()
|
||||
{
|
||||
// Override CM
|
||||
Window.DefaultBorderStyle = LineStyle.Single;
|
||||
Dialog.DefaultButtonAlignment = Alignment.Center;
|
||||
Dialog.DefaultBorderStyle = LineStyle.Single;
|
||||
|
||||
var expected = 5;
|
||||
var d = new Dialog { X = expected, Y = expected, Height = 5, Width = 5 };
|
||||
Begin (d);
|
||||
@@ -1188,6 +1208,11 @@ public class DialogTests
|
||||
|
||||
int iterations = -1;
|
||||
|
||||
// Override CM
|
||||
Window.DefaultBorderStyle = LineStyle.Single;
|
||||
Dialog.DefaultButtonAlignment = Alignment.Center;
|
||||
Dialog.DefaultBorderStyle = LineStyle.Single;
|
||||
|
||||
Iteration += (s, a) =>
|
||||
{
|
||||
iterations++;
|
||||
@@ -1361,6 +1386,10 @@ public class DialogTests
|
||||
params Button [] btns
|
||||
)
|
||||
{
|
||||
// Override CM
|
||||
Dialog.DefaultButtonAlignment = Alignment.Center;
|
||||
Dialog.DefaultBorderStyle = LineStyle.Single;
|
||||
|
||||
var dlg = new Dialog
|
||||
{
|
||||
Title = title,
|
||||
|
||||
@@ -174,6 +174,10 @@ public class MessageBoxTests
|
||||
var btn =
|
||||
$"{CM.Glyphs.LeftBracket}{CM.Glyphs.LeftDefaultIndicator} btn {CM.Glyphs.RightDefaultIndicator}{CM.Glyphs.RightBracket}";
|
||||
|
||||
// Override CM
|
||||
MessageBox.DefaultButtonAlignment = Alignment.End;
|
||||
MessageBox.DefaultBorderStyle = LineStyle.Double;
|
||||
|
||||
Application.Iteration += (s, a) =>
|
||||
{
|
||||
iterations++;
|
||||
@@ -239,6 +243,10 @@ public class MessageBoxTests
|
||||
var btn =
|
||||
$"{CM.Glyphs.LeftBracket}{CM.Glyphs.LeftDefaultIndicator} btn {CM.Glyphs.RightDefaultIndicator}{CM.Glyphs.RightBracket}";
|
||||
|
||||
// Override CM
|
||||
MessageBox.DefaultButtonAlignment = Alignment.End;
|
||||
MessageBox.DefaultBorderStyle = LineStyle.Double;
|
||||
|
||||
Application.Iteration += (s, a) =>
|
||||
{
|
||||
iterations++;
|
||||
@@ -415,6 +423,10 @@ public class MessageBoxTests
|
||||
int iterations = -1;
|
||||
((FakeDriver)Application.Driver).SetBufferSize (70, 15);
|
||||
|
||||
// Override CM
|
||||
MessageBox.DefaultButtonAlignment = Alignment.End;
|
||||
MessageBox.DefaultBorderStyle = LineStyle.Double;
|
||||
|
||||
Application.Iteration += (s, a) =>
|
||||
{
|
||||
iterations++;
|
||||
|
||||
Reference in New Issue
Block a user