diff options
| author | JJ Liebig <jonathan.liebig@gmail.com> | 2026-09-24 14:29:07 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-24 14:29:07 +0200 |
| commit | d11c0c34cf8f9c2dc0d6fb45c58c307aa5ce8a6b (patch) | |
| tree | 1ff9b3daf9fbd5945bb97883fa61bcab7378f6e1 /scripts/test_windows_input.ps1 | |
| parent | b7781a67e2d7f89ce07022d8ecdf39687ea552b0 (diff) | |
fix: report partial Windows input coverage and clear clipboard for tests (#4566)
* fix: report partial Windows input coverage and clear clipboard for tests
* fix: require evidence from each Windows input channel
* fix: reject clipboard format count errors
Diffstat (limited to 'scripts/test_windows_input.ps1')
| -rw-r--r-- | scripts/test_windows_input.ps1 | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/scripts/test_windows_input.ps1 b/scripts/test_windows_input.ps1 index 364ce414..42d23bd7 100644 --- a/scripts/test_windows_input.ps1 +++ b/scripts/test_windows_input.ps1 @@ -17,6 +17,7 @@ param( [int[]] $Heights = @(24, 50), [string] $OutputDirectory, [switch] $AllowInputInjection, + [switch] $ClearClipboard, [switch] $Manual, [switch] $MatrixOnly ) @@ -47,6 +48,19 @@ if (@($selectedCases | Where-Object id -eq 'mouse-focus-refresh').Count) { if ($controllerWindow -eq [IntPtr]::Zero) { throw 'Controller has no foreground window for focus-cycle qualification' } [HerdrInputGauntlet.Desktop]::AssertNotElevated([HerdrInputGauntlet.Desktop]::Pid($controllerWindow)) } +$needsClipboard = $false +foreach ($case in $selectedCases) { + if ($case.kind -in @('paste', 'mouse-interleave', 'clipboard-image', 'clipboard-mixed') -and + @($Modes | Where-Object { $case.expected.ContainsKey($_) }).Count) { $needsClipboard = $true; break } +} +$clipboardFormatsAtStart = if ($needsClipboard -and $ClearClipboard) { + [HerdrInputGauntlet.Desktop]::ClearClipboardForRun() +} else { [HerdrInputGauntlet.Desktop]::CountClipboardFormats() } +if ($needsClipboard -and -not $ClearClipboard -and $clipboardFormatsAtStart -ne 0) { + throw 'Clipboard is not empty; save its contents, then clear it or pass -ClearClipboard to discard it before running' +} +$clipboardFormatsCleared = if ($needsClipboard -and $ClearClipboard) { $clipboardFormatsAtStart } else { 0 } +Write-Host "Clipboard formats before build: $clipboardFormatsAtStart; cleared for test: $clipboardFormatsCleared" $sourceCommit = $null $sourceDirty = $null if (-not $ExePath) { @@ -78,11 +92,11 @@ Write-Host "Herdr under test: $exe" Write-Host "SHA-256: $exeHash" Write-Host "Modes: $($Modes -join ', '); widths: $($Widths -join ', '); heights: $($Heights -join ', ')" Write-Host "Channels: $($Channels -join ', '); paths: $($Paths -join ', '); cases: $(if (@($Cases).Count) { $Cases -join ', ' } else { 'all' })" -Write-Host "Clipboard formats at start: $([HerdrInputGauntlet.Desktop]::CountClipboardFormats()) (paste runs only when zero)" $document = @{ schema = 1; run = [IO.Path]::GetFileName($root); started = [DateTime]::UtcNow.ToString('O'); source_commit = $sourceCommit; source_dirty = $sourceDirty; exe = $exe; exe_sha256 = $exeHash; powershell = $PSVersionTable.PSVersion.ToString(); os = [Environment]::OSVersion.VersionString; profile = $Profile; controller_elevated = $false; observations = @(); hosts = @(); errors = @(); cleanup_errors = @(); + clipboard_clear_requested = [bool]$ClearClipboard; clipboard_formats_at_start = $clipboardFormatsAtStart; clipboard_formats_cleared = $clipboardFormatsCleared; widths = $Widths; heights = $Heights; modes = $Modes; channels = $Channels; paths = $Paths; cases = @($selectedCases | ForEach-Object id); note = 'Desktop input evidence; native qualification still required' } $rawReport = Join-Path $root 'observations.json' |
