diff --git a/tools/run-offline-pixel-gate.ps1 b/tools/run-offline-pixel-gate.ps1 index 75e80f1c..0345b982 100644 --- a/tools/run-offline-pixel-gate.ps1 +++ b/tools/run-offline-pixel-gate.ps1 @@ -161,6 +161,22 @@ finally { $captures = Get-ChildItem (Join-Path $Out 'screenshots') -Filter *.png Write-Step "captured $($captures.Count) screenshot(s) into $Out" +# The offline window is minimised but still focusable, so a stray scroll or key +# press from whoever is at the keyboard can move the camera mid-capture. That +# produces two screenshots of the same scene from different camera positions — +# a huge, entirely spurious pixel difference. This actually happened during +# slice V4b. Detect it and fail loudly rather than let a comparison be +# interpreted as a rendering regression. +$cameraInput = Select-String -Path $log -Pattern 'ScrollUp|ScrollDown|ZoomIn|ZoomOut|CameraZoom' ` + -CaseSensitive -ErrorAction SilentlyContinue +if ($cameraInput) { + Write-Host '' + Write-Host '[pixel-gate] ABORTED: camera-affecting input reached the capture window.' -ForegroundColor Red + Write-Host ' The capture is not comparable. Re-run without touching the machine.' -ForegroundColor Red + $cameraInput | Select-Object -First 5 | ForEach-Object { Write-Host " $($_.Line)" -ForegroundColor Red } + exit 2 +} + # --- 4. Compare against the baseline ----------------------------------------- if (-not $Baseline) { Write-Step 'no baseline supplied; capture only'