fix: drive native progression from each current camera view
This commit is contained in:
@@ -22,6 +22,54 @@ function Step([string]$Name,[string[]]$Arguments=@(),[int]$Delay=500) {
|
||||
}
|
||||
function Save([string]$Name) { Adb @('pull',$remote,(Join-Path $EvidenceDir "$Name.json")) | Out-Null; return Get-Content -LiteralPath (Join-Path $EvidenceDir "$Name.json") -Raw | ConvertFrom-Json }
|
||||
function Same($First,$Second) { return ($First | ConvertTo-Json -Depth 12 -Compress) -eq ($Second | ConvertTo-Json -Depth 12 -Compress) }
|
||||
function NativePointer([int[]]$Contacts) {
|
||||
$touchHelper=Join-Path $PSScriptRoot 'send-composition-touch.ps1'
|
||||
& pwsh -NoProfile -CommandWithArgs '$ErrorActionPreference="Stop"; $touchHelper=$args[0]; $touchContacts=@($args[1..($args.Count-1)]|ForEach-Object {[int]$_}); & $touchHelper -Contacts $touchContacts; exit $LASTEXITCODE' $touchHelper @Contacts
|
||||
$actualExit=$LASTEXITCODE
|
||||
$commands.Add(@{command='EmulatorController.sendTouch';contacts=$Contacts;exitCode=$actualExit;utc=[DateTime]::UtcNow.ToString('o')})
|
||||
if($actualExit-ne0){throw "Actual native gesture failed: $actualExit"}
|
||||
}
|
||||
function NativeMoveAndHold([string]$Name,$Board,[string]$Id,[int[]]$End) {
|
||||
$point=BallPoint $Board $Id
|
||||
Check "$Name-safe-start-end" ((WorldSafe $point)-and(WorldSafe $End)) 'Current exact whole-ID projection and documented UI-safe endpoints'
|
||||
$confirmed=Save "$Name-confirmed"
|
||||
try {
|
||||
NativePointer @($point[0],$point[1],79,1024);Start-Sleep -Milliseconds 100
|
||||
# One real Move precedes assistance. Hold the finger still as the camera changes;
|
||||
# a 500ms interpolated swipe would reuse stale screen coordinates during rotation.
|
||||
NativePointer @($End[0],$End[1],79,1024);Start-Sleep -Milliseconds 700
|
||||
Step "$Name-during-live-camera" @() 0
|
||||
Check "$Name-live-preview-not-saved" (Same $confirmed (Save "$Name-during-save")) 'Stationary native contact: preview and auto camera never overwrite confirmed state'
|
||||
} finally { NativePointer @($End[0],$End[1],79,0) }
|
||||
Step $Name @() 2500
|
||||
return Save "$Name-dropped"
|
||||
}
|
||||
function AssertNativeMerge([string]$Name,$Before,$After,[string]$SourceId,[int]$TargetCount=0) {
|
||||
$idsBefore=@($Before.balls.id|Sort-Object);$idsAfter=@($After.balls.id|Sort-Object)
|
||||
Check "$Name-exact-original-ids" (Same $idsBefore $idsAfter) 'No lost, duplicated or substituted IDs after actual native input'
|
||||
Check "$Name-manual-camera-preserved" (Same $Before.camera $After.camera) 'Automatic assistance never persists as the manual camera'
|
||||
$source=@($Before.groups|Where-Object {$_.ballIds-contains$SourceId})[0]
|
||||
$merged=@($After.groups|Where-Object {$_.ballIds-contains$SourceId})[0]
|
||||
$targets=@($Before.groups|Where-Object {$_.id-ne$source.id-and@($_.ballIds|Where-Object {$merged.ballIds-notcontains$_}).Count-eq0})
|
||||
Check "$Name-actual-source-and-target-membership" ($targets.Count-eq1-and$merged.ballIds.Count-eq($source.ballIds.Count+$targets[0].ballIds.Count)-and@($source.ballIds|Where-Object {$merged.ballIds-notcontains$_}).Count-eq0-and($TargetCount-eq0-or$targets[0].ballIds.Count-eq$TargetCount)) 'Grabbed source plus exactly one actual foreign group; requested target size retained'
|
||||
$firstBefore=@($Before.balls|Where-Object id -eq $SourceId)[0].position
|
||||
$firstAfter=@($After.balls|Where-Object id -eq $SourceId)[0].position
|
||||
$delta=[Numerics.Vector3]::new($firstAfter.x-$firstBefore.x,$firstAfter.y-$firstBefore.y,$firstAfter.z-$firstBefore.z)
|
||||
Check "$Name-requested-source-actually-moved" ($delta.Length()-gt.00001) "Actual grabbed source $SourceId moved in 3D"
|
||||
foreach($ball in $Before.balls){
|
||||
$actual=@($After.balls|Where-Object id -eq $ball.id)[0].position
|
||||
if($source.ballIds-contains$ball.id){
|
||||
$movement=[Numerics.Vector3]::new($actual.x-$ball.position.x,$actual.y-$ball.position.y,$actual.z-$ball.position.z)
|
||||
Check "$Name-rigid-source-$($ball.id)" (($movement-$delta).Length()-lt.0001) 'Every source member shares the same actual translation'
|
||||
}else{Check "$Name-stationary-foreign-$($ball.id)" (Same $ball.position $actual) 'Unselected foreign balls retain exact saved positions'}
|
||||
}
|
||||
$distance=[double]::PositiveInfinity
|
||||
foreach($sid in $source.ballIds){foreach($tid in $targets[0].ballIds){
|
||||
$s=@($After.balls|Where-Object id -eq $sid)[0].position;$t=@($After.balls|Where-Object id -eq $tid)[0].position
|
||||
$distance=[Math]::Min($distance,[Numerics.Vector3]::new($s.x-$t.x,$s.y-$t.y,$s.z-$t.z).Length())
|
||||
}}
|
||||
Check "$Name-real-three-dimensional-contact" ($distance-ge.998-and$distance-le1.002) "Actual source/foreign unit-sphere contact distance=$distance; screen overlap alone is insufficient"
|
||||
}
|
||||
function BallPoint($Board,[string]$Id) {
|
||||
$matching=@($Board.balls | Where-Object id -eq $Id)
|
||||
if ($matching.Count -ne 1) { throw "Native projection requires exactly one existing ball ID: $Id" }
|
||||
|
||||
Reference in New Issue
Block a user