mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
* Fixes #3956. MessageBox doesn't return the index of IsDefault button * Change to Theory test. * Fix unit test 'Error opening terminal: unknown.' * Remove RunningUnitTests = true because constructor already set it. --------- Co-authored-by: Tig <tig@users.noreply.github.com>
This commit is contained in:
@@ -504,5 +504,25 @@ public class MessageBoxTests
|
||||
Application.Run (top);
|
||||
top.Dispose ();
|
||||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[SetupFakeDriver]
|
||||
[MemberData (nameof (AcceptingKeys))]
|
||||
public void Button_IsDefault_True_Return_His_Index_On_Accepting (Key key)
|
||||
{
|
||||
Application.Init ();
|
||||
|
||||
Application.Iteration += (_, _) => Assert.True (Application.RaiseKeyDownEvent (key));
|
||||
int res = MessageBox.Query ("hey", "IsDefault", "Yes", "No");
|
||||
|
||||
Assert.Equal (0, res);
|
||||
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
public static IEnumerable<object []> AcceptingKeys ()
|
||||
{
|
||||
yield return [Key.Enter];
|
||||
yield return [Key.Space];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user