Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Terminal.Gui/Views/Dialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,16 @@ public Dialog ()
BorderStyle = DefaultBorderStyle;
base.ShadowStyle = DefaultShadow;

SchemeName = SchemeManager.SchemesToSchemeName (Schemes.Dialog);

_buttonContainer = new ()
{
Id = "Dialog.ButtonContainer",
CanFocus = true,
X = 0,
Y = Pos.AnchorEnd (),
Width = Dim.Fill (),
Height = Dim.Auto (),
SchemeName = "Menu"
Height = Dim.Auto ()
};
Padding!.Add (_buttonContainer);

Expand Down Expand Up @@ -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
Expand Down
76 changes: 76 additions & 0 deletions Tests/UnitTestsParallelizable/Views/MessageBoxTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,80 @@ public static IEnumerable<object []> 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<IApplication?> 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<IApplication?> 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 ();
}
}
}
Loading