Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Tools/windows/Tests/CanvasCardContextMenu.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,16 @@ Describe "Stable canvas card context menu (managed mocks only)" {
$source | Should -Match '\$deleteLoopPopup = Open-CanvasCardContextMenu \$process \$root \$shellWindow'
$source | Should -Not -Match 'PostContextMenu\(\$shellWindow, 3\)\)\s*`\s*"Delete Loop'
}
It "requires an exact owned modal completion for the Delete Loop command" {
$source | Should -Match '\[GraphCodeUiaGateState\]::ClickPopupMenuItemForModal\('
$source | Should -Match '(?s)ClickPopupMenuItemForModal\(\s*\$deleteLoopPopup, \$shellWindow, \[int\]\$deleteLoopItem\.Position, \[int\]\$deleteLoopItem\.Id,\s*\[uint32\]\$process\.Id, \$deleteLoopTitle'
$source | Should -Match '\$deleteLoopClick\.Completion\.ToString\(\) -ceq "ExpectedOwnedModal"'
$source | Should -Match '\$deleteLoopClick\.ModalWindow -ne \[IntPtr\]::Zero'
$identityRequirement = '\[IntPtr\]\$deleteLoopDialog\.Current\.NativeWindowHandle -eq \$deleteLoopClick\.ModalWindow'
$source | Should -Match $identityRequirement
$source.Replace(
'[IntPtr]$deleteLoopDialog.Current.NativeWindowHandle -eq $deleteLoopClick.ModalWindow',
'[IntPtr]$deleteLoopDialog.Current.NativeWindowHandle -ne $deleteLoopClick.ModalWindow'
) | Should -Not -Match $identityRequirement
}
}
26 changes: 20 additions & 6 deletions Tools/windows/Tests/ValidationRunner.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4518,15 +4518,19 @@ Start-Sleep -Seconds 60
'$deleteTargetSelection.Select()',
'Require $deleteTargetSelection.Current.IsSelected',
'UIA_DELETE_LOOP_TARGET',
'[GraphCodeUiaGateState]::PostContextMenu($shellWindow, 3)',
'$deleteLoopPopup = Wait-ForPopupMenu $process $shellWindow "Delete Loop"',
'$deleteLoopPopup = Open-CanvasCardContextMenu $process $root $shellWindow',
'$deleteLoopItems = @(Get-PopupMenuItems $deleteLoopPopup)',
'$_.Id -eq 5103 -and $_.Enabled',
'Require ($null -ne $deleteLoopItem)',
'[GraphCodeUiaGateState]::ClickPopupMenuItemForModal(',
'$deleteLoopPopup, $shellWindow, [int]$deleteLoopItem.Position, [int]$deleteLoopItem.Id',
'Require ($null -ne $deleteLoopClick)',
'$process.Id, $deleteLoopTitle',
'Require ($null -ne $deleteLoopClick',
'$deleteLoopClick.Completion.ToString() -ceq "ExpectedOwnedModal"',
'$deleteLoopClick.ModalWindow -ne [IntPtr]::Zero',
'UIA_DELETE_LOOP_MENU',
'"GraphCodeWindowsDialogContent" $deleteLoopTitle "Delete Loop custom sheet"',
'[IntPtr]$deleteLoopDialog.Current.NativeWindowHandle -eq $deleteLoopClick.ModalWindow',
'[IntPtr]$deleteLoopDialog.Current.NativeWindowHandle, 9808',
'Wait-UiaOwnedSheetGoneByContentClass $process.Id $shellWindow ` "GraphCodeWindowsDialogContent") "Delete Loop custom sheet remained open after Cancel"'
)
Expand All @@ -4539,16 +4543,24 @@ Start-Sleep -Seconds 60
return $true
}
$directDeleteMutant = $uiaLiveGateSource.Replace(
'[GraphCodeUiaGateState]::PostContextMenu($shellWindow, 3)',
'Open-CanvasCardContextMenu $process $root $shellWindow',
'[GraphCodeUiaGateState]::SendCommand($shellWindow, 5103)'
)
$missingItemAssertionMutant = $uiaLiveGateSource.Replace(
'Require ($null -ne $deleteLoopItem)',
'$null = ($null -ne $deleteLoopItem)'
)
$wrongClickMutant = $uiaLiveGateSource.Replace(
'$deleteLoopPopup, $shellWindow, [int]$deleteLoopItem.Position, [int]$deleteLoopItem.Id',
'$deleteLoopPopup, $shellWindow, 0, 5103'
'$process.Id, $deleteLoopTitle',
'$process.Id, "Wrong Delete Loop title"'
)
$missingModalReceiptMutant = $uiaLiveGateSource.Replace(
'$deleteLoopClick.Completion.ToString() -ceq "ExpectedOwnedModal"',
'$deleteLoopClick.Completion.ToString() -ceq "PopupClosed"'
)
$replacedModalMutant = $uiaLiveGateSource.Replace(
'[IntPtr]$deleteLoopDialog.Current.NativeWindowHandle -eq $deleteLoopClick.ModalWindow',
'[IntPtr]$deleteLoopDialog.Current.NativeWindowHandle -ne $deleteLoopClick.ModalWindow'
)
$wrongCancelMutant = $uiaLiveGateSource.Replace(
'[IntPtr]$deleteLoopDialog.Current.NativeWindowHandle, 9808',
Expand All @@ -4562,6 +4574,8 @@ Start-Sleep -Seconds 60
(Test-DeleteLoopContextSource $directDeleteMutant) -or
(Test-DeleteLoopContextSource $missingItemAssertionMutant) -or
(Test-DeleteLoopContextSource $wrongClickMutant) -or
(Test-DeleteLoopContextSource $missingModalReceiptMutant) -or
(Test-DeleteLoopContextSource $replacedModalMutant) -or
(Test-DeleteLoopContextSource $wrongCancelMutant) -or
(Test-DeleteLoopContextSource $missingTeardownMutant)) {
throw "RED: UIA Delete Loop invocation does not re-establish the stable fixture selection after Rename"
Expand Down
4 changes: 2 additions & 2 deletions Tools/windows/Tests/WindowsShell.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -717,10 +717,10 @@ Invoke-Native "Shell process ownership mock contracts" {
Invoke-Native "Stable canvas card context menu mock contracts" {
. (Join-Path $PSScriptRoot "..\Import-PinnedPester.ps1")
$cardMenuResults = Invoke-Pester -Path (Join-Path $PSScriptRoot "CanvasCardContextMenu.Tests.ps1") -PassThru
if ($cardMenuResults.TotalCount -ne 16 -or $cardMenuResults.PassedCount -ne 16 -or
if ($cardMenuResults.TotalCount -ne 17 -or $cardMenuResults.PassedCount -ne 17 -or
$cardMenuResults.FailedCount -ne 0 -or $cardMenuResults.SkippedCount -ne 0 -or
$cardMenuResults.NotRunCount -ne 0) {
throw "Stable canvas card context menu mock contracts did not pass all 16 unskipped cases"
throw "Stable canvas card context menu mock contracts did not pass all 17 unskipped cases"
}
Write-Host "CANVAS_CARD_CONTEXT_MENU_MOCK_CASES=$($cardMenuResults.TotalCount)"
$global:LASTEXITCODE = 0
Expand Down
13 changes: 10 additions & 3 deletions Tools/windows/ValidationRunner/Ui/UiDerivedContracts.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,13 @@ function Confirm-DeleteContext([string] $Gate) {
'$deleteLoopPopup = Open-CanvasCardContextMenu $process $root $shellWindow ` $renameGraphIdentity $rawWalker "Delete Loop"',
'$deleteLoopItems = @(Get-PopupMenuItems $deleteLoopPopup)',
'$_.Id -eq 5103 -and $_.Enabled', 'Require ($null -ne $deleteLoopItem)',
'$deleteLoopPopup, $shellWindow, [int]$deleteLoopItem.Position, [int]$deleteLoopItem.Id', 'Require ($null -ne $deleteLoopClick)',
'[GraphCodeUiaGateState]::ClickPopupMenuItemForModal(',
'$deleteLoopPopup, $shellWindow, [int]$deleteLoopItem.Position, [int]$deleteLoopItem.Id', '$process.Id, $deleteLoopTitle',
'Require ($null -ne $deleteLoopClick',
'$deleteLoopClick.Completion.ToString() -ceq "ExpectedOwnedModal"',
'$deleteLoopClick.ModalWindow -ne [IntPtr]::Zero',
'UIA_DELETE_LOOP_MENU', '"GraphCodeWindowsDialogContent" $deleteLoopTitle "Delete Loop custom sheet"',
'[IntPtr]$deleteLoopDialog.Current.NativeWindowHandle -eq $deleteLoopClick.ModalWindow',
'[IntPtr]$deleteLoopDialog.Current.NativeWindowHandle, 9808',
'Wait-UiaOwnedSheetGoneByContentClass $process.Id $shellWindow ` "GraphCodeWindowsDialogContent") "Delete Loop custom sheet remained open after Cancel"')
}
Expand All @@ -157,7 +162,9 @@ Invoke-Derived 'ui.root.source.line-6157' {
$mutants = @(
@('Open-CanvasCardContextMenu $process $root $shellWindow', '[GraphCodeUiaGateState]::SendCommand($shellWindow, 5103)'),
@('Require ($null -ne $deleteLoopItem)', '$null = ($null -ne $deleteLoopItem)'),
@('$deleteLoopPopup, $shellWindow, [int]$deleteLoopItem.Position, [int]$deleteLoopItem.Id', '$deleteLoopPopup, $shellWindow, 0, 5103'),
@('$process.Id, $deleteLoopTitle', '$process.Id, "Wrong Delete Loop title"'),
@('$deleteLoopClick.Completion.ToString() -ceq "ExpectedOwnedModal"', '$deleteLoopClick.Completion.ToString() -ceq "PopupClosed"'),
@('[IntPtr]$deleteLoopDialog.Current.NativeWindowHandle -eq $deleteLoopClick.ModalWindow', '[IntPtr]$deleteLoopDialog.Current.NativeWindowHandle -ne $deleteLoopClick.ModalWindow'),
@('[IntPtr]$deleteLoopDialog.Current.NativeWindowHandle, 9808', '[IntPtr]$deleteLoopDialog.Current.NativeWindowHandle, 7'),
@('Wait-UiaOwnedSheetGoneByContentClass $process.Id $shellWindow', 'Wait-UiaOwnedSheetGoneDisabled $process.Id $shellWindow')
)
Expand All @@ -167,7 +174,7 @@ Invoke-Derived 'ui.root.source.line-6157' {
Assert-Derived (-not (Confirm-DeleteContext ($source.Replace($mutant[0], $mutant[1])))) 'Delete context mutant accepted'
$checked++
}
Assert-Derived ($checked -eq 5) 'Delete context mutation count changed'
Assert-Derived ($checked -eq 7) 'Delete context mutation count changed'
}
Invoke-Derived 'ui.root.source.line-6182' {
foreach ($pattern in @('UIA_RENAME_DISPATCH', 'UIA_RENAME_INPUT', 'UIA_RENAME_OUTCOME', 'SetEditTextById',
Expand Down
15 changes: 11 additions & 4 deletions Tools/windows/uia-live-gate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9464,15 +9464,22 @@ try {
}) | Select-Object -First 1
Require ($null -ne $deleteLoopItem) `
"Delete Loop context menu omitted its enabled Delete action: $(Format-PopupMenuItems $deleteLoopItems)"
$deleteLoopClick = [GraphCodeUiaGateState]::ClickPopupMenuItem(
$deleteLoopPopup, $shellWindow, [int]$deleteLoopItem.Position, [int]$deleteLoopItem.Id, [uint32]$process.Id
$deleteLoopClick = [GraphCodeUiaGateState]::ClickPopupMenuItemForModal(
$deleteLoopPopup, $shellWindow, [int]$deleteLoopItem.Position, [int]$deleteLoopItem.Id,
[uint32]$process.Id, $deleteLoopTitle
)
Require ($null -ne $deleteLoopClick) "Delete Loop context-menu action could not be clicked"
Require ($null -ne $deleteLoopClick -and
$deleteLoopClick.Completion.ToString() -ceq "ExpectedOwnedModal" -and
$deleteLoopClick.ModalWindow -ne [IntPtr]::Zero) `
"Delete Loop context-menu action did not produce an exact owned modal"
Write-Host ("UIA_DELETE_LOOP_MENU command=$($deleteLoopItem.Id) " +
"hilite=$($deleteLoopClick.Hilite) keyboardFallback=$($deleteLoopClick.UsedKeyboardFallback)")
"hilite=$($deleteLoopClick.Hilite) keyboardFallback=$($deleteLoopClick.UsedKeyboardFallback) " +
"completion=$($deleteLoopClick.Completion) modal=$($deleteLoopClick.ModalWindow)")
$deleteLoopDialog = Wait-UiaOwnedSheetByContentClass $process.Id $shellWindow `
"GraphCodeWindowsDialogContent" $deleteLoopTitle "Delete Loop custom sheet"
Require ($null -ne $deleteLoopDialog) "Delete Loop did not open its custom sheet"
Require ([IntPtr]$deleteLoopDialog.Current.NativeWindowHandle -eq $deleteLoopClick.ModalWindow) `
"Delete Loop custom sheet identity differs from the popup modal completion"
$deleteLoopIdentity = Assert-UiaOwnedSheet $deleteLoopDialog $process.Id $shellWindow `
$deleteLoopTitle "GraphCodeWindowsDialogContent" "Delete Loop custom sheet"
$null = Write-UiaDialogSheet768Observation $deleteLoopDialog $process.Id $shellWindow `
Expand Down
Loading