diff --git a/Tools/windows/Tests/AccessibilityProvider.Native.Tests.Harness.Tests.ps1 b/Tools/windows/Tests/AccessibilityProvider.Native.Tests.Harness.Tests.ps1 index 9c09a991..b7310cd1 100644 --- a/Tools/windows/Tests/AccessibilityProvider.Native.Tests.Harness.Tests.ps1 +++ b/Tools/windows/Tests/AccessibilityProvider.Native.Tests.Harness.Tests.ps1 @@ -27,7 +27,7 @@ foreach ($headless in @($false, $true)) { "Headless navigation selection: 179 checks, 0 failures") } else { @("", '"%GRAPHCODE_NATIVE_PROVIDER%"', "oleaut32.lib uiautomationcore.lib user32.lib", - "Native accessibility provider: 280 checks, 0 failures") + "Native accessibility provider: 281 checks, 0 failures") } $actual = @($plan.definitions, $plan.providerSource, $plan.libraries, $plan.summary) for ($index = 0; $index -lt $expected.Count; $index++) { @@ -47,6 +47,25 @@ foreach ($literal in @( if (-not $nativeSource.Contains($literal)) { throw "Native compile plan is not enforced: $literal" } $planChecks++ } +function Test-NativeHeaderIdentityContract([string] $Source) { + $attention = 'check\(stringProperty\(attention,\s*UIA_AutomationIdPropertyId\)\s*==\s*L"header-attention:needs-you",\s*"Needs-you header exposes its exact public automation id"\);' + $overflow = 'check\(stringProperty\(overflow,\s*UIA_AutomationIdPropertyId\)\.rfind\(\s*L"header-overflow-",\s*0\)\s*==\s*0,\s*"header overflow exposes its stable automation id prefix"\);' + return $Source -match "(?s)$attention" -and $Source -match "(?s)$overflow" +} +$nativeCppSource = [IO.File]::ReadAllText((Join-Path $PSScriptRoot "AccessibilityProvider.Native.Tests.cpp")) +if (-not (Test-NativeHeaderIdentityContract $nativeCppSource)) { + throw "Native header checks do not independently assert Needs-you and overflow identities" +} +$planChecks++ +$mutatedNativeCppSource = $nativeCppSource.Replace( + 'L"header-attention:needs-you"', + 'L"header-attention:mutated"', + [StringComparison]::Ordinal) +if ($mutatedNativeCppSource -ceq $nativeCppSource -or + (Test-NativeHeaderIdentityContract $mutatedNativeCppSource)) { + throw "Native header mutation retained the exact Needs-you identity contract" +} +$planChecks++ Write-Host "Native accessibility compile plan: $planChecks checks, 0 failures (source/data only)" if ($PlanOnly) { if ($ArtifactRoot) { diff --git a/Tools/windows/Tests/AccessibilityProvider.Native.Tests.cpp b/Tools/windows/Tests/AccessibilityProvider.Native.Tests.cpp index 44aaa016..d2d4a1b2 100644 --- a/Tools/windows/Tests/AccessibilityProvider.Native.Tests.cpp +++ b/Tools/windows/Tests/AccessibilityProvider.Native.Tests.cpp @@ -868,22 +868,28 @@ static void nativeHeaderOverflowChecks(IRawElementProviderSimple *provider, HWND "header overflow provider supports fragment hit-testing"); if (!root) return; const char *identity = "header-overflow:actions"; - const char *identities[] = {identity}; - const char *names[] = {"More actions"}; - const int parents[] = {1}; - const int none[] = {0}; - const int eligible[] = {1}; - const int invokable_flags[] = {1}; - const int bounds[] = {444, 5, 480, 29}; + const char *identities[] = {"header-attention:needs-you", identity}; + const char *names[] = {"1 need you", "More actions"}; + const int parents[] = {1, 1}; + const int none[] = {0, 0}; + const int eligible[] = {1, 1}; + const int invokable_flags[] = {1, 1}; + const int bounds[] = {300, 5, 412, 29, 444, 5, 480, 29}; auto update = &gc_uia_update; check(update(provider, "Header overflow", identities, names, parents, none, eligible, - invokable_flags, bounds, 1, 0, 1, 0, 0, 0, 0) == S_OK, + invokable_flags, bounds, 2, 0, 1, 0, 0, 0, 0) == S_OK, "header overflow publishes"); auto *projects = child(root_fragment, NavigateDirection_FirstChild); - auto *overflow = child(projects, NavigateDirection_FirstChild); + auto *attention = child(projects, NavigateDirection_FirstChild); + IRawElementProviderFragment *overflow = nullptr; + if (attention) attention->Navigate(NavigateDirection_NextSibling, &overflow); checkName(overflow, L"More actions"); - check(stringProperty(overflow, UIA_AutomationIdPropertyId).rfind(L"header-overflow-", 0) == 0, + check(stringProperty(attention, UIA_AutomationIdPropertyId) == + L"header-attention:needs-you", + "Needs-you header exposes its exact public automation id"); + check(stringProperty(overflow, UIA_AutomationIdPropertyId).rfind( + L"header-overflow-", 0) == 0, "header overflow exposes its stable automation id prefix"); IRawElementProviderSimple *simple = nullptr; @@ -937,6 +943,7 @@ static void nativeHeaderOverflowChecks(IRawElementProviderSimple *provider, HWND "header overflow wins native UIA coordinate hit-testing"); if (overflow) overflow->Release(); + if (attention) attention->Release(); if (projects) projects->Release(); root->Release(); } diff --git a/Tools/windows/Tests/AccessibilityProvider.Native.Tests.ps1 b/Tools/windows/Tests/AccessibilityProvider.Native.Tests.ps1 index c5952b73..37b84054 100644 --- a/Tools/windows/Tests/AccessibilityProvider.Native.Tests.ps1 +++ b/Tools/windows/Tests/AccessibilityProvider.Native.Tests.ps1 @@ -92,7 +92,7 @@ function Get-AccessibilityProviderNativeTestPlan([bool] $HeadlessSelection) { definitions = "" providerSource = '"%GRAPHCODE_NATIVE_PROVIDER%"' libraries = "oleaut32.lib uiautomationcore.lib user32.lib" - summary = "Native accessibility provider: 280 checks, 0 failures" + summary = "Native accessibility provider: 281 checks, 0 failures" } } $plan = Get-AccessibilityProviderNativeTestPlan ([bool]$HeadlessSelection) diff --git a/Tools/windows/Tests/ValidationRunner.Tests.ps1 b/Tools/windows/Tests/ValidationRunner.Tests.ps1 index 3c3d0379..601c2873 100644 --- a/Tools/windows/Tests/ValidationRunner.Tests.ps1 +++ b/Tools/windows/Tests/ValidationRunner.Tests.ps1 @@ -3795,6 +3795,7 @@ try { return $value.StartsWith($prefix, [StringComparison]::Ordinal) } foreach ($identity in @( + 'header-attention:needs-you', 'wire-node-1000000000000000001', 'mark-entry-1000000000000000002', 'overview-wire-node-1000000000000000003', diff --git a/Tools/windows/ValidationRunner/Manifests/ui.json b/Tools/windows/ValidationRunner/Manifests/ui.json index ac90d434..3a16678f 100644 --- a/Tools/windows/ValidationRunner/Manifests/ui.json +++ b/Tools/windows/ValidationRunner/Manifests/ui.json @@ -1,6 +1,6 @@ { "units": [ - { "id": "ui.navigation.headless-runner-plan", "owner": "Ui", "minimumCount": 14, "exactCount": 14, "requiredGroups": [] }, + { "id": "ui.navigation.headless-runner-plan", "owner": "Ui", "minimumCount": 16, "exactCount": 16, "requiredGroups": [] }, { "id": "ui.popup.effect.expected-modal-transition", "owner": "Ui", "minimumCount": 1, "exactCount": 1, "requiredGroups": [] }, { "id": "ui.popup.receipt.cancelled-after-queued-input", "owner": "Ui", "minimumCount": 1, "exactCount": 1, "requiredGroups": [] }, { "id": "ui.navigation.selection-event-controls", "owner": "Ui", "minimumCount": 12, "exactCount": 12, diff --git a/Tools/windows/uia-live-gate.ps1 b/Tools/windows/uia-live-gate.ps1 index 68baae7e..93e8ae14 100644 --- a/Tools/windows/uia-live-gate.ps1 +++ b/Tools/windows/uia-live-gate.ps1 @@ -4443,7 +4443,7 @@ function Read-MultiProjectMetadataProperty($element, [string] $property) { function Test-MultiProjectSourceSupportedChromeId([string] $identity, [string] $ownership) { if ($ownership -cne "owned") { return $false } $staticIds = @("canvas-primary-action", "zoom-out", "actual-size", "zoom-in", "fit-canvas", - "overview-destination", "quick-chats-destination") + "overview-destination", "quick-chats-destination", "header-attention:needs-you") $chromePrefixes = @("sidebar-section-", "project-row-", "project-new-loop-", "project-disclosure-", "quick-chats-header-", "quick-chat-new-", "quick-chats-disclosure-", "quick-chat-row-", "sidebar-update-banner-", "workspace-footer-", diff --git a/graphcode-windows/src/AccessibilityProvider.cpp b/graphcode-windows/src/AccessibilityProvider.cpp index d716143c..7fd6f3e9 100644 --- a/graphcode-windows/src/AccessibilityProvider.cpp +++ b/graphcode-windows/src/AccessibilityProvider.cpp @@ -1354,6 +1354,8 @@ class Node final : public IRawElementProviderSimple, std::wstring automationIdLocked() const { if (isRowKey(id_)) { const Row &row = state_->rows.at(id_); + if (row.identity == "header-attention:needs-you") + return L"header-attention:needs-you"; const int parent = row.parent; const wchar_t *prefix = row.identity.rfind("sidebar-section:", 0) == 0 ? L"sidebar-section-" :