59 lines
1.9 KiB
PowerShell
59 lines
1.9 KiB
PowerShell
$ErrorActionPreference = 'Stop'
|
|
|
|
Add-Type -AssemblyName System.Drawing
|
|
|
|
$root = Split-Path -Parent $PSScriptRoot
|
|
$screenshots = Join-Path $root 'docs/design/screens/handoff/2026-07-14'
|
|
$files = [ordered]@{
|
|
initial = Join-Path $screenshots 'G06-selected-strip-final-initial-recheck-360x800.png'
|
|
results = Join-Path $screenshots 'G06-selected-strip-final-results-360x800.png'
|
|
empty = Join-Path $screenshots 'G06-selected-strip-final-empty-360x800.png'
|
|
}
|
|
$images = @{}
|
|
|
|
try {
|
|
foreach ($state in $files.Keys) {
|
|
$file = $files[$state]
|
|
if (-not (Test-Path -LiteralPath $file)) {
|
|
throw "Missing G06 $state screenshot: $file"
|
|
}
|
|
|
|
$image = [System.Drawing.Bitmap]::new($file)
|
|
$images[$state] = $image
|
|
if ($image.Width -ne 360 -or $image.Height -ne 800) {
|
|
throw "G06 $state screenshot must be 360x800, got $($image.Width)x$($image.Height)"
|
|
}
|
|
|
|
foreach ($point in @(@(0, 0), @(359, 0), @(0, 799), @(359, 799))) {
|
|
if ($image.GetPixel($point[0], $point[1]).A -ne 255) {
|
|
throw "G06 $state screenshot must have an opaque viewport"
|
|
}
|
|
}
|
|
}
|
|
|
|
foreach ($state in @('results', 'empty')) {
|
|
$stableDifferenceCount = 0
|
|
$fullDifferenceCount = 0
|
|
for ($y = 0; $y -lt 800; $y++) {
|
|
for ($x = 0; $x -lt 360; $x++) {
|
|
if ($images.initial.GetPixel($x, $y).ToArgb() -ne $images[$state].GetPixel($x, $y).ToArgb()) {
|
|
$fullDifferenceCount++
|
|
if ($y -lt 150) { $stableDifferenceCount++ }
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($stableDifferenceCount -ne 0) {
|
|
throw "G06 $state screenshot changed $stableDifferenceCount pixels in the stable header/title region"
|
|
}
|
|
if ($fullDifferenceCount -lt 100) {
|
|
throw "G06 $state screenshot does not visibly differ from the initial state"
|
|
}
|
|
}
|
|
}
|
|
finally {
|
|
foreach ($image in $images.Values) { $image.Dispose() }
|
|
}
|
|
|
|
Write-Output 'G06-SCREENSHOT-CONSISTENCY PASS'
|