Files
jiapuapp/tests/a02-asset-alpha-audit.ps1
T
2026-07-14 07:01:45 +08:00

28 lines
1001 B
PowerShell

$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$asset = Join-Path $root 'static/assets/modules/auth/opaque/a02-login-panel.png'
if (-not (Test-Path -LiteralPath $asset)) {
throw 'Missing A02 login-panel asset'
}
Add-Type -AssemblyName System.Drawing
$bitmap = [System.Drawing.Bitmap]::FromFile($asset)
$width = [int]$bitmap.Width
$height = [int]$bitmap.Height
$corners = @(
$bitmap.GetPixel(0, 0).A,
$bitmap.GetPixel(($width - 1), 0).A,
$bitmap.GetPixel(0, ($height - 1)).A,
$bitmap.GetPixel(($width - 1), ($height - 1)).A
)
$bitmap.Dispose()
$ratio = [double]$width / $height
if ($width -ne 940 -or $height -ne 1672) { throw 'A02 login-panel asset must remain 940 x 1672px.' }
if ([Math]::Abs($ratio - 0.5622) -gt 0.001) { throw 'A02 login-panel asset must retain its approved panel ratio.' }
if (($corners | Where-Object { $_ -ne 255 }).Count -ne 0) { throw 'A02 login-panel asset must have opaque outer corners.' }
Write-Output 'A02-ASSET-ALPHA-AUDIT PASS'