-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Windows] Implemented the AutomationPeers to the Border control #27713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Tamilarasan-Paranthaman
wants to merge
4
commits into
dotnet:main
Choose a base branch
from
Tamilarasan-Paranthaman:fix-27627
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+89
−0
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
bf89eec
Implemented automation peer for Border
Tamilarasan-Paranthaman 308a66e
Border automation peer changes
Tamilarasan-Paranthaman f5f5450
Added test case.
Tamilarasan-Paranthaman fd4179b
Updated MauiBorderAutomationPeer.cs
Tamilarasan-Paranthaman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,30 @@ | ||
namespace Maui.Controls.Sample.Issues; | ||
|
||
[Issue(IssueTracker.Github, 27627, "[Windows] Border Automation Peer", PlatformAffected.UWP)] | ||
public partial class Issue27627 : ContentPage | ||
{ | ||
public Issue27627() | ||
{ | ||
var grid = new Grid(); | ||
|
||
var border = new Border | ||
{ | ||
AutomationId = "TestBorder", | ||
VerticalOptions = LayoutOptions.Center, | ||
HeightRequest = 100, | ||
Stroke = Colors.Red | ||
}; | ||
|
||
var label = new Label | ||
{ | ||
Text = "Test Label", | ||
HorizontalOptions = LayoutOptions.Center, | ||
VerticalOptions = LayoutOptions.Center | ||
}; | ||
|
||
border.Content = label; | ||
|
||
grid.Children.Add(border); | ||
Content = grid; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27627.cs
This file contains hidden or 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,22 @@ | ||
using NUnit.Framework; | ||
using UITest.Appium; | ||
using UITest.Core; | ||
|
||
namespace Microsoft.Maui.TestCases.Tests.Issues | ||
{ | ||
public class Issue27627 : _IssuesUITest | ||
{ | ||
public override string Issue => "[Windows] Border Automation Peer"; | ||
|
||
public Issue27627(TestDevice device) | ||
: base(device) | ||
{ } | ||
|
||
[Test] | ||
[Category(UITestCategories.Border)] | ||
public void VerifyBorderAutomationPeer() | ||
{ | ||
App.WaitForElement("TestBorder"); | ||
} | ||
} | ||
} |
This file contains hidden or 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 hidden or 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,25 @@ | ||
using Microsoft.UI.Xaml.Automation.Peers; | ||
using Microsoft.UI.Xaml.Controls; | ||
|
||
namespace Microsoft.Maui.Platform | ||
{ | ||
// TODO: Make this class public in .NET 10.0. Issue Link: https://github.com/dotnet/maui/issues/30205 | ||
internal class MauiBorderAutomationPeer : FrameworkElementAutomationPeer | ||
{ | ||
internal MauiBorderAutomationPeer(Panel owner) : base(owner) { } | ||
|
||
protected override AutomationControlType GetAutomationControlTypeCore() | ||
{ | ||
return AutomationControlType.Pane; | ||
} | ||
|
||
protected override string GetClassNameCore() | ||
{ | ||
return nameof(Panel); | ||
} | ||
|
||
protected override bool IsControlElementCore() => true; | ||
|
||
protected override bool IsContentElementCore() => true; | ||
} | ||
} |
This file contains hidden or 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 |
---|---|---|
@@ -1 +1,2 @@ | ||
#nullable enable | ||
override Microsoft.Maui.Platform.ContentPanel.OnCreateAutomationPeer() -> Microsoft.UI.Xaml.Automation.Peers.AutomationPeer! |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before you set the automation peer, is this not possible? I mean, this test appears to be looking for a element with this ID, so I just want to check if the test would fail without this new peer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the test failed without the new peer, and it passed after adding it. I have attached the output images for your reference.