Browse Source
Merge pull request #11458 from AvaloniaUI/fixes/11370-automation-effectively-disabled
Use `IsEffectivelyEnabled` in automation peers.
pull/11465/head
Max Katz
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
13 additions and
1 deletions
-
samples/IntegrationTestApp/MainWindow.axaml
-
src/Avalonia.Controls/Automation/Peers/ControlAutomationPeer.cs
-
tests/Avalonia.IntegrationTests.Appium/ButtonTests.cs
|
|
|
@ -47,6 +47,9 @@ |
|
|
|
<Button Name="DisabledButton" IsEnabled="False"> |
|
|
|
Disabled Button |
|
|
|
</Button> |
|
|
|
<Button Name="EffectivelyDisabledButton" Command="{ReflectionBinding DoesntExist}"> |
|
|
|
Effectively Disabled Button |
|
|
|
</Button> |
|
|
|
<Button Name="BasicButton"> |
|
|
|
Basic Button |
|
|
|
</Button> |
|
|
|
|
|
|
|
@ -151,7 +151,7 @@ namespace Avalonia.Automation.Peers |
|
|
|
protected override bool HasKeyboardFocusCore() => Owner.IsFocused; |
|
|
|
protected override bool IsContentElementCore() => true; |
|
|
|
protected override bool IsControlElementCore() => true; |
|
|
|
protected override bool IsEnabledCore() => Owner.IsEnabled; |
|
|
|
protected override bool IsEnabledCore() => Owner.IsEffectivelyEnabled; |
|
|
|
protected override bool IsKeyboardFocusableCore() => Owner.Focusable; |
|
|
|
protected override void SetFocusCore() => Owner.Focus(); |
|
|
|
|
|
|
|
|
|
|
|
@ -27,6 +27,15 @@ namespace Avalonia.IntegrationTests.Appium |
|
|
|
Assert.False(button.Enabled); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void EffectivelyDisabledButton() |
|
|
|
{ |
|
|
|
var button = _session.FindElementByAccessibilityId("EffectivelyDisabledButton"); |
|
|
|
|
|
|
|
Assert.Equal("Effectively Disabled Button", button.Text); |
|
|
|
Assert.False(button.Enabled); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void BasicButton() |
|
|
|
{ |
|
|
|
|