Stabilize composition Android input verification and unchanged asset normalization

This commit is contained in:
NINI
2026-10-05 05:51:12 +09:00
parent e924e697a2
commit 08ce71c0a2
2 changed files with 14 additions and 4 deletions
+13 -3
View File
@@ -7,6 +7,7 @@ $checks=[Collections.Generic.List[object]]::new(); $commands=[Collections.Generi
$package='com.magnetismheroes.game'; $activity="$package/com.unity3d.player.UnityPlayerGameActivity"; $remote="/sdcard/Android/data/$package/files/progress.json" $package='com.magnetismheroes.game'; $activity="$package/com.unity3d.player.UnityPlayerGameActivity"; $remote="/sdcard/Android/data/$package/files/progress.json"
$result=[ordered]@{milestone='Composition';sourceCommit=(& git rev-parse HEAD);sourceDirty=[bool](& git status --porcelain);serial=$Serial;apkSha256=(Get-FileHash $ApkPath -Algorithm SHA256).Hash;status='failed';checks=@();commands=@()} $result=[ordered]@{milestone='Composition';sourceCommit=(& git rev-parse HEAD);sourceDirty=[bool](& git status --porcelain);serial=$Serial;apkSha256=(Get-FileHash $ApkPath -Algorithm SHA256).Hash;status='failed';checks=@();commands=@()}
$networkBefore=$null $networkBefore=$null
$physicalInput=$false
function Adb([string[]]$Arguments) { function Adb([string[]]$Arguments) {
$output=& $adb -s $Serial @Arguments 2>&1; $code=$LASTEXITCODE $output=& $adb -s $Serial @Arguments 2>&1; $code=$LASTEXITCODE
$commands.Add(@{command=('adb -s '+$Serial+' '+($Arguments -join ' '));exitCode=$code;output=($output -join "`n")}) $commands.Add(@{command=('adb -s '+$Serial+' '+($Arguments -join ' '));exitCode=$code;output=($output -join "`n")})
@@ -17,6 +18,7 @@ function Check([string]$Id,[bool]$Passed,[string]$Actual) {
} }
function Step([string]$Name,[string[]]$Arguments=@(),[int]$Delay=500) { function Step([string]$Name,[string[]]$Arguments=@(),[int]$Delay=500) {
& (Join-Path $PSScriptRoot 'observe.ps1') -Step $Name -AdbArguments $Arguments -Serial $Serial -EvidenceDir $EvidenceDir -DelayMilliseconds $Delay & (Join-Path $PSScriptRoot 'observe.ps1') -Step $Name -AdbArguments $Arguments -Serial $Serial -EvidenceDir $EvidenceDir -DelayMilliseconds $Delay
if ($Arguments.Count -gt 1 -and $Arguments[1] -eq 'input') { $script:physicalInput=$false }
} }
function Save([string]$Name) { Adb @('pull',$remote,(Join-Path $EvidenceDir "$Name.json")) | Out-Null; return Get-Content (Join-Path $EvidenceDir "$Name.json") -Raw | ConvertFrom-Json } function Save([string]$Name) { Adb @('pull',$remote,(Join-Path $EvidenceDir "$Name.json")) | Out-Null; return Get-Content (Join-Path $EvidenceDir "$Name.json") -Raw | ConvertFrom-Json }
function Fixture([int]$Stage) { function Fixture([int]$Stage) {
@@ -40,6 +42,15 @@ function StartAudio([string]$Name,[int]$Seconds) {
$recorders.Add(@{name=$Name;process=$process}); Start-Sleep -Seconds 2 $recorders.Add(@{name=$Name;process=$process}); Start-Sleep -Seconds 2
} }
function Touch([int[]]$Contacts) { function Touch([int[]]$Contacts) {
if (!$script:physicalInput) {
# ADB injects a virtual touchscreen. Finish one harmless physical contact before changing devices.
& (Join-Path $PSScriptRoot 'send-composition-touch.ps1') -Contacts @(30,400,999,100)
Start-Sleep -Milliseconds 100
& (Join-Path $PSScriptRoot 'send-composition-touch.ps1') -Contacts @(30,400,999,0)
Start-Sleep -Milliseconds 100
$commands.Add(@{command='EmulatorController.sendTouch physical-device warmup: 30,400,999,100 then 30,400,999,0';exitCode=0})
$script:physicalInput=$true
}
& (Join-Path $PSScriptRoot 'send-composition-touch.ps1') -Contacts $Contacts & (Join-Path $PSScriptRoot 'send-composition-touch.ps1') -Contacts $Contacts
$commands.Add(@{command=('EmulatorController.sendTouch contacts='+($Contacts -join ','));exitCode=0}) $commands.Add(@{command=('EmulatorController.sendTouch contacts='+($Contacts -join ','));exitCode=0})
} }
@@ -79,9 +90,8 @@ try {
Step 'ten-all-selection-drag' @('shell','input','swipe','1120','510','850','510','500') Step 'ten-all-selection-drag' @('shell','input','swipe','1120','510','850','510','500')
Check 'ten-all-unchanged' (SameJson $tenBefore (Save 'ten-all-after')) 'Entire selection preserves JSON' Check 'ten-all-unchanged' (SameJson $tenBefore (Save 'ten-all-after')) 'Entire selection preserves JSON'
Step 'ten-deselect-right' @('shell','input','tap','1280','510'); Step 'ten-selected-count-face-number' Step 'ten-deselect-right' @('shell','input','tap','1280','510'); Step 'ten-selected-count-face-number'
Touch @(1120,510,411,100); Start-Sleep -Milliseconds 100; Touch @(900,510,411,100); Step 'ten-split-preview' # Android injection preserves the out-of-window endpoint; emulator physical touch clamps its coordinates.
# UI cancel is a separate product action; release first restores invalid/outside gesture via a real edge release. Step 'ten-outside-cancel' @('shell','input','swipe','1120','510','2500','510','650')
Touch @(2500,510,411,0); Step 'ten-outside-cancel'
Check 'ten-outside-cancel-unchanged' (SameJson $tenBefore (Save 'ten-outside-after')) 'Off-board release keeps committed JSON' Check 'ten-outside-cancel-unchanged' (SameJson $tenBefore (Save 'ten-outside-after')) 'Off-board release keeps committed JSON'
Step 'ten-select-again' @('shell','input','tap','1120','510'); Step 'ten-split-again' @('shell','input','tap','312','832'); Step 'ten-selection-again' @('shell','input','tap','1120','510') Step 'ten-select-again' @('shell','input','tap','1120','510'); Step 'ten-split-again' @('shell','input','tap','312','832'); Step 'ten-selection-again' @('shell','input','tap','1120','510')
Touch @(1120,510,421,100); Touch @(1030,510,421,100); Touch @(1390,510,422,100) Touch @(1120,510,421,100); Touch @(1030,510,421,100); Touch @(1390,510,422,100)
+1 -1
View File
@@ -51,7 +51,7 @@ try {
$record.normalizedUnchangedSettings = @() $record.normalizedUnchangedSettings = @()
$record.settingsContentChecks = @() $record.settingsContentChecks = @()
if (!$record.sourceDirty) { if (!$record.sourceDirty) {
foreach ($settingsPath in @('ProjectSettings/GraphicsSettings.asset','ProjectSettings/ProjectAuditorSettings.asset','ProjectSettings/ProjectSettings.asset')) { foreach ($settingsPath in @('ProjectSettings/GraphicsSettings.asset','ProjectSettings/ProjectAuditorSettings.asset','ProjectSettings/ProjectSettings.asset','Assets/Settings/Mobile_RPAsset.asset','Assets/Settings/UniversalRenderPipelineGlobalSettings.asset')) {
$workingBlob = & git hash-object --path=$settingsPath -- $settingsPath $workingBlob = & git hash-object --path=$settingsPath -- $settingsPath
$workingExit = $LASTEXITCODE $workingExit = $LASTEXITCODE
$sourceBlob = & git rev-parse "HEAD:$settingsPath" $sourceBlob = & git rev-parse "HEAD:$settingsPath"