Repository navigation
fix(automation): Use qualified ClassName for controls-library peers - #26234
Conversation
|
Claude finished @morning4coffe-dev's task in 19s —— View job Review summaryVerdict: ship. I found no blocking issues, so I posted no inline comments (0 high, 0 medium, 0 low). Code review assessment (by inspection only; I did not build or run tests):
Non-blocking notes:
|
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
Claude finished @morning4coffe-dev's task in 10s —— View job Review summaryVerdict: ship. 0 high, 0 medium, 0 low. No inline comments posted. Code review (by inspection only; I did not build or run tests):
Non-blocking notes:
|
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 244695 found UI Test snapshots differences: Details
|
c941e22 to
727000a
Compare
|
Claude finished @morning4coffe-dev's task in 10s —— View job Review summaryVerdict: ship. 0 high, 0 medium, 0 low. No inline comments posted. Code review (by inspection only; I did not build or run tests):
Non-blocking notes:
|
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 244948 found UI Test snapshots differences: Details
|
|
This pull request is merged. |
MartinZikmund
left a comment
There was a problem hiding this comment.
Checked all 27 controls/dev/**/*AutomationPeer.cpp overrides. Every touched peer returns winrt::hstring_name_of<T>() there, so typeof(T).FullName matches 1:1, and ColorSpectrum correctly comes out under .Primitives. The MenuBar removal and m_ClassName = string.Empty match WinUI too (MenuBarAutomationPeer.cpp has no override, and the FrameworkElementAutomationPeer ctor does m_ClassName.Set(L"")). LGTM.
Optional nits:
- About
MediaPlayerElementAutomationPeerin the description: it's actually right. WinUI'sMediaPlayerElementAutomationPeer_Partial.cppliterally returnsL"MediaPlayerElementAutomationPeer"(same forNamedContainerAutomationPeer), so no follow-up needed there. When_Peer_Created_Then_ClassName_Is_Namespace_Qualifiednow also covers the MenuBar""row, so a more neutral name like..._Then_ClassName_Matches_WinUIwould fit better.
GitHub Issue: closes #24992
PR Type:
🐞 Bugfix
What changed? 🚀
The controls-library peers (
controls/dev/*in WinUI) returnwinrt::hstring_name_of<T>()fromGetClassNameCore, which is the namespace-qualified name, e.g.Microsoft.UI.Xaml.Controls.InfoBar. When they were ported, that becamenameof(T), so 18 peers reported justInfoBar,TabView, and so on. Tools that match on ClassName (UI test frameworks, Accessibility Insights rules) saw different values than on WinUI.typeof(T).FullName, likeExpander,NumberBoxandSplitButtonalready did.ColorSpectrumcorrectly comes out asMicrosoft.UI.Xaml.Controls.Primitives.ColorSpectrum.MenuBarAutomationPeerhad an Uno-onlyGetClassNameCorereturning"MenuBar". WinUI'sMenuBarAutomationPeer.cpphas no override, so it's removed. This means MenuBar now reports"", not a qualified name as the issue suggested.FrameworkElementAutomationPeer.m_ClassNamedefaulted tonull. WinUI's constructor sets it toL"", so it'sstring.Emptynow.Tests:
Given_ControlsLibraryAutomationPeerClassNamehas a row per control (27, including the ones that were already right), plus one for the base FE peer.Behavior change: UI tests that matched on the short ClassName will need the qualified name, the same value they'd get on WinUI.
MediaPlayerElementAutomationPeer.GetClassNameCorereturnsnameof(MediaPlayerElementAutomationPeer), which also looks wrong, but it isn't part of the controls library, so I left it out of this PR.PR Checklist ✅
Screenshots Compare Test Runresults.🤖 Generated with Claude Code