From af17636d1ffa3c2ea7ed5dcd22aae026f9aa96b6 Mon Sep 17 00:00:00 2001 From: Tig Kindel Date: Mon, 18 Dec 2023 11:27:10 -0700 Subject: [PATCH] prep for Dialog to use Dim.Auto - Make Dialog tests not depend on MessageBox --- UnitTests/Dialogs/DialogTests.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/UnitTests/Dialogs/DialogTests.cs b/UnitTests/Dialogs/DialogTests.cs index 1625f6ab1..4a4d004bd 100644 --- a/UnitTests/Dialogs/DialogTests.cs +++ b/UnitTests/Dialogs/DialogTests.cs @@ -790,7 +790,13 @@ namespace Terminal.Gui.DialogTests { btn2 = new Button ("Show Sub"); btn3 = new Button ("Close"); btn3.Clicked += (s, e) => Application.RequestStop (); - btn2.Clicked += (s, e) => { MessageBox.Query (string.Empty, "ya", "Ok"); }; + btn2.Clicked += (s, e) => { + // Don't test MessageBox in Dialog unit tests! + var subBtn = new Button ("Ok") { IsDefault = true }; + var subDlg = new Dialog (subBtn) { Text = "ya", Width = 20, Height = 5 }; + subBtn.Clicked += (s, e) => Application.RequestStop (subDlg); + Application.Run (subDlg); + }; var dlg = new Dialog (btn2, btn3); Application.Run (dlg); @@ -818,11 +824,11 @@ namespace Terminal.Gui.DialogTests { } else if (iterations == 2) { TestHelpers.AssertDriverContentsWithFrameAre (@$" ┌───────────────────────┐ - │ ┌────────────────┐ │ - │ │ ya │ │ - │ │ │ │ - │ │ {btn} │ │ - │ └────────────────┘ │ + │ ┌──────────────────┐ │ + │ │ya │ │ + │ │ │ │ + │ │ {btn} │ │ + │ └──────────────────┘ │ │{CM.Glyphs.LeftBracket} Show Sub {CM.Glyphs.RightBracket} {CM.Glyphs.LeftBracket} Close {CM.Glyphs.RightBracket} │ └───────────────────────┘", output);