|
|
|
@ -448,6 +448,27 @@ namespace Avalonia.Controls.UnitTests |
|
|
|
Assert.Equal(2, raised); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Button_IsDefault_Should_Not_Work_When_Button_Is_Not_Effectively_Visible() |
|
|
|
{ |
|
|
|
using (UnitTestApplication.Start(TestServices.StyledWindow)) |
|
|
|
{ |
|
|
|
var raised = 0; |
|
|
|
var panel = new Panel(); |
|
|
|
var target = new Button(); |
|
|
|
panel.Children.Add(target); |
|
|
|
var window = new Window { Content = panel }; |
|
|
|
window.Show(); |
|
|
|
|
|
|
|
target.Click += (s, e) => ++raised; |
|
|
|
|
|
|
|
target.IsDefault = true; |
|
|
|
panel.IsVisible = false; |
|
|
|
window.RaiseEvent(CreateKeyDownEvent(Key.Enter)); |
|
|
|
Assert.Equal(0, raised); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Button_IsCancel_Works() |
|
|
|
@ -482,6 +503,27 @@ namespace Avalonia.Controls.UnitTests |
|
|
|
Assert.Equal(2, raised); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Button_IsCancel_Should_Not_Work_When_Button_Is_Not_Effectively_Visible() |
|
|
|
{ |
|
|
|
using (UnitTestApplication.Start(TestServices.StyledWindow)) |
|
|
|
{ |
|
|
|
var raised = 0; |
|
|
|
var panel = new Panel(); |
|
|
|
var target = new Button(); |
|
|
|
panel.Children.Add(target); |
|
|
|
var window = new Window { Content = panel }; |
|
|
|
window.Show(); |
|
|
|
|
|
|
|
target.Click += (s, e) => ++raised; |
|
|
|
|
|
|
|
target.IsCancel = true; |
|
|
|
panel.IsVisible = false; |
|
|
|
window.RaiseEvent(CreateKeyDownEvent(Key.Escape)); |
|
|
|
Assert.Equal(0, raised); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Button_CommandParameter_Does_Not_Change_While_Execution() |
|
|
|
|