forked from AvaloniaUI/Avalonia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[macOS][X11] Release mouse capture when dialog shown (AvaloniaUI#16205)
* Added integration test for AvaloniaUI#14525. * Release mouse capture when dialog shown. Fixes AvaloniaUI#14525. * Release X11 pointer capture when dialog shown.
- Loading branch information
Showing
8 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
using System.Windows.Input; | ||
|
||
namespace IntegrationTestApp; | ||
|
||
internal class DelegateCommand : ICommand | ||
{ | ||
private readonly Action _action; | ||
private readonly Func<object?, bool> _canExecute; | ||
public DelegateCommand(Action action, Func<object?, bool>? canExecute = default) | ||
{ | ||
_action = action; | ||
_canExecute = canExecute ?? new(_ => true); | ||
} | ||
|
||
public event EventHandler? CanExecuteChanged { add { } remove { } } | ||
public bool CanExecute(object? parameter) => _canExecute(parameter); | ||
public void Execute(object? parameter) => _action(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using OpenQA.Selenium.Interactions; | ||
using Xunit; | ||
|
||
namespace Avalonia.IntegrationTests.Appium | ||
{ | ||
[Collection("Default")] | ||
public class PointerTests | ||
{ | ||
private readonly AppiumDriver _session; | ||
|
||
public PointerTests(DefaultAppFixture fixture) | ||
{ | ||
_session = fixture.Session; | ||
|
||
var tabs = _session.FindElementByAccessibilityId("MainTabs"); | ||
var tab = tabs.FindElementByName("Pointer"); | ||
tab.Click(); | ||
} | ||
|
||
[Fact] | ||
public void Pointer_Capture_Is_Released_When_Showing_Dialog() | ||
{ | ||
var button = _session.FindElementByAccessibilityId("PointerPageShowDialog"); | ||
|
||
button.OpenWindowWithClick().Dispose(); | ||
|
||
var status = _session.FindElementByAccessibilityId("PointerCaptureStatus"); | ||
Assert.Equal("None", status.Text); | ||
} | ||
} | ||
} |