diff --git a/Terminal.Gui/Views/Dialog.cs b/Terminal.Gui/Views/Dialog.cs index 6db8083b04..e1d6337342 100644 --- a/Terminal.Gui/Views/Dialog.cs +++ b/Terminal.Gui/Views/Dialog.cs @@ -94,6 +94,8 @@ public Dialog () BorderStyle = DefaultBorderStyle; base.ShadowStyle = DefaultShadow; + SchemeName = SchemeManager.SchemesToSchemeName (Schemes.Dialog); + _buttonContainer = new () { Id = "Dialog.ButtonContainer", @@ -101,8 +103,7 @@ public Dialog () X = 0, Y = Pos.AnchorEnd (), Width = Dim.Fill (), - Height = Dim.Auto (), - SchemeName = "Menu" + Height = Dim.Auto () }; Padding!.Add (_buttonContainer); @@ -345,8 +346,7 @@ private void SetStyle () { if (IsRunning) { - SchemeName = SchemeManager.SchemesToSchemeName (Schemes.Dialog); - Padding!.SetScheme (SchemeManager.GetScheme (Schemes.Base)); + //Padding!.SetScheme (SchemeManager.GetScheme (Schemes.Base)); Arrangement |= ViewArrangement.Movable | ViewArrangement.Resizable | ViewArrangement.Overlapped; } else diff --git a/Tests/UnitTestsParallelizable/Views/MessageBoxTests.cs b/Tests/UnitTestsParallelizable/Views/MessageBoxTests.cs index e0f6acca25..e630d76a46 100644 --- a/Tests/UnitTestsParallelizable/Views/MessageBoxTests.cs +++ b/Tests/UnitTestsParallelizable/Views/MessageBoxTests.cs @@ -77,4 +77,80 @@ public static IEnumerable AcceptingKeys () yield return [Key.Enter]; yield return [Key.Space]; } + + // Claude - Opus 4.5 + [Fact] + public void Query_Sets_Dialog_SchemeName () + { + IApplication app = Application.Create (); + app.Init (DriverRegistry.Names.ANSI); + + try + { + string? schemeName = null; + var iteration = 0; + + app.Iteration += OnApplicationOnIteration; + int? result = MessageBox.Query (app, "Test", "Message", "OK"); + app.Iteration -= OnApplicationOnIteration; + + Assert.Equal ("Dialog", schemeName); + + void OnApplicationOnIteration (object? s, EventArgs a) + { + iteration++; + + if (iteration == 1) + { + // Capture the SchemeName from the running dialog + var dialog = app.TopRunnableView as Dialog; + Assert.NotNull (dialog); + schemeName = dialog.SchemeName; + app.RequestStop (); + } + } + } + finally + { + app.Dispose (); + } + } + + // Claude - Opus 4.5 + [Fact] + public void ErrorQuery_Sets_Error_SchemeName () + { + IApplication app = Application.Create (); + app.Init (DriverRegistry.Names.ANSI); + + try + { + string? schemeName = null; + var iteration = 0; + + app.Iteration += OnApplicationOnIteration; + int? result = MessageBox.ErrorQuery (app, "Error", "Error Message", "OK"); + app.Iteration -= OnApplicationOnIteration; + + Assert.Equal ("Error", schemeName); + + void OnApplicationOnIteration (object? s, EventArgs a) + { + iteration++; + + if (iteration == 1) + { + // Capture the SchemeName from the running dialog + var dialog = app.TopRunnableView as Dialog; + Assert.NotNull (dialog); + schemeName = dialog.SchemeName; + app.RequestStop (); + } + } + } + finally + { + app.Dispose (); + } + } }