From 81a7ed7f44d5072d1320bf78c8b9ab1c8a438f2b Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 5 Jun 2026 20:13:38 +0100 Subject: [PATCH] Add native Android parity captures --- docs/parity-testing-harness.md | 11 +++++++-- scripts/capture-android-screenshot.ps1 | 33 ++++++++++++++++---------- scripts/run-parity-smoke.ps1 | 9 +++++++ tools/parity/parity-manifest.json | 10 ++++++++ 4 files changed, 49 insertions(+), 14 deletions(-) diff --git a/docs/parity-testing-harness.md b/docs/parity-testing-harness.md index fbd52db..2caa594 100644 --- a/docs/parity-testing-harness.md +++ b/docs/parity-testing-harness.md @@ -39,6 +39,13 @@ viewport matrix: - `tablet`: 768 x 1024 - `desktop`: 1280 x 720 +Device runtimes also capture native physical panel cases when the platform +adapter can control orientation without overriding size. Android currently +emits: + +- `native-portrait`: Periwinkle at physical portrait resolution +- `native-landscape`: Periwinkle at physical landscape resolution + The semantic runner writes: - `artifacts/parity/latest.md` @@ -82,8 +89,8 @@ The harness tracks every target runtime: `/var/mobile/Library/EveCanvas/capture-request` service. Current iOS capture is fixed-device until a simulator or device-resize adapter exists. - Android / Kotlin: screenshot target through `adb install`, activity launch, - `adb shell wm size`, and `adb exec-out screencap`; the script restores the - device size after each viewport. + optional `adb shell wm size`, orientation control, and `adb exec-out + screencap`; the script restores device size and rotation after each viewport. - Windows / Flutter: screenshot target through the Flutter parity golden smoke, with phone, tablet, and desktop goldens. - Linux / Flutter: requires a Linux runner. A Windows host must fail this diff --git a/scripts/capture-android-screenshot.ps1 b/scripts/capture-android-screenshot.ps1 index 4f8e4f8..451345a 100644 --- a/scripts/capture-android-screenshot.ps1 +++ b/scripts/capture-android-screenshot.ps1 @@ -29,20 +29,25 @@ if (-not (Test-Path $absoluteApk)) { $overrideSize = $Width -gt 0 -and $Height -gt 0 $overrideRotation = $Orientation -ne "natural" -$previousAccelerometerRotation = $null -$previousUserRotation = $null +$previousWindowUserRotation = $null +$previousIgnoreOrientationRequest = $null try { if ($overrideRotation) { - $previousAccelerometerRotation = (adb shell settings get system accelerometer_rotation).Trim() - $previousUserRotation = (adb shell settings get system user_rotation).Trim() + $previousWindowUserRotation = (adb shell cmd window user-rotation).Trim() + $previousIgnoreOrientationRequest = (adb shell cmd window get-ignore-orientation-request).Trim() $rotation = if ($Orientation -eq "landscape") { "1" } else { "0" } - adb shell settings put system accelerometer_rotation 0 | Out-Host - adb shell settings put system user_rotation $rotation | Out-Host + adb shell cmd window set-ignore-orientation-request true | Out-Host + adb shell cmd window user-rotation lock $rotation | Out-Host + } + + if ($overrideSize -or $overrideRotation) { + adb shell am force-stop $PackageName | Out-Host } if ($overrideSize) { - adb shell am force-stop $PackageName | Out-Host - adb shell wm size "${Width}x${Height}" | Out-Host + $wmWidth = if ($Orientation -eq "landscape") { $Height } else { $Width } + $wmHeight = if ($Orientation -eq "landscape") { $Width } else { $Height } + adb shell wm size "${wmWidth}x${wmHeight}" | Out-Host if ($LASTEXITCODE -ne 0) { throw "adb wm size failed with exit code $LASTEXITCODE" } @@ -72,11 +77,15 @@ try { adb shell wm size reset | Out-Host } if ($overrideRotation) { - if ($previousAccelerometerRotation -and $previousAccelerometerRotation -ne "null") { - adb shell settings put system accelerometer_rotation $previousAccelerometerRotation | Out-Host + if ($previousWindowUserRotation -match "^free") { + adb shell cmd window user-rotation free | Out-Host + } elseif ($previousWindowUserRotation -match "^lock\s+(\d+)") { + adb shell cmd window user-rotation lock $Matches[1] | Out-Host } - if ($previousUserRotation -and $previousUserRotation -ne "null") { - adb shell settings put system user_rotation $previousUserRotation | Out-Host + if ($previousIgnoreOrientationRequest -match "true") { + adb shell cmd window set-ignore-orientation-request true | Out-Host + } elseif ($previousIgnoreOrientationRequest -match "false") { + adb shell cmd window set-ignore-orientation-request false | Out-Host } } } diff --git a/scripts/run-parity-smoke.ps1 b/scripts/run-parity-smoke.ps1 index 52a989e..c6f3f59 100644 --- a/scripts/run-parity-smoke.ps1 +++ b/scripts/run-parity-smoke.ps1 @@ -12,6 +12,7 @@ $runRoot = Join-Path $projectRoot (Join-Path $OutputDirectory $stamp) New-Item -ItemType Directory -Force $runRoot | Out-Null $manifest = Get-Content (Join-Path $projectRoot "tools\parity\parity-manifest.json") | ConvertFrom-Json $responsiveCases = @($manifest.responsiveCases) +$androidNativeCases = @($manifest.androidNativeCases) $results = [ordered]@{ schema = "gamecult.eve.parity_smoke.v1" @@ -87,6 +88,14 @@ try { } } + foreach ($case in $androidNativeCases) { + Invoke-Capture "android-$($case.id)" { + powershell -ExecutionPolicy Bypass -File .\scripts\capture-android-screenshot.ps1 ` + -OutputPath (Join-Path $runRoot "android-periwinkle-$($case.id).png") ` + -Orientation $case.orientation + } + } + foreach ($case in $responsiveCases) { Invoke-Capture "windows-$($case.id)" { powershell -ExecutionPolicy Bypass -File .\scripts\capture-flutter-parity.ps1 ` diff --git a/tools/parity/parity-manifest.json b/tools/parity/parity-manifest.json index 9c11743..88f906e 100644 --- a/tools/parity/parity-manifest.json +++ b/tools/parity/parity-manifest.json @@ -23,6 +23,16 @@ "deviceScale": 1 } ], + "androidNativeCases": [ + { + "id": "native-portrait", + "orientation": "portrait" + }, + { + "id": "native-landscape", + "orientation": "landscape" + } + ], "fixtures": [ { "id": "cultui-inspector",