$report=[Native41]::Top([uint32]$l.pid,'Roster health');Click $report 'Close';Start-Sleep -Milliseconds 400
Click $main 'Extra fields';Start-Sleep -Milliseconds 500
$extra=[Native41]::Top([uint32]$l.pid,'OpenHoops extra fields')
$bar=[Native41]::GetParent([Native41]::Button($extra,'Apply fields'))
$candidates=@([Native41]::Children($extra)|Where-Object{[Windows.Automation.AutomationElement]::FromHandle($_).Current.ClassName -match '^WindowsForms10.Window.8' -and $_ -ne $bar})
if($candidates.Count -ne 1){throw 'Extra field grid ambiguous'}
$grid=$candidates[0];$null=[Native41]::SetForegroundWindow($extra);Start-Sleep -Milliseconds 200
if([Native41]::GetForegroundWindow() -ne $extra){throw 'Owned extra window is not foreground'}
$rect=New-Object Native41+Rect;$null=[Native41]::GetWindowRect($grid,[ref]$rect)
$null=[Native41]::SetCursorPos(($rect.L+600),($rect.T+52))
$point=New-Object Native41+Point;$point.X=$rect.L+600;$point.Y=$rect.T+52
$hit=[Native41]::WindowFromPoint($point);$owner=0;$null=[Native41]::GetWindowThreadProcessId($hit,[ref]$owner)
if($owner -ne $l.pid){throw 'Target point not owned by editor'}
[Native41]::mouse_event(2,0,0,0,[UIntPtr]::Zero);[Native41]::mouse_event(4,0,0,0,[UIntPtr]::Zero);Start-Sleep -Milliseconds 100
[Native41]::keybd_event(113,0,0,[UIntPtr]::Zero);[Native41]::keybd_event(113,0,2,[UIntPtr]::Zero);Start-Sleep -Milliseconds 200
$input=[Native41]::Class($extra,'EDIT')
$null=[Native41]::SendMessage($input,12,[IntPtr]::Zero,'Modern display name')
if([Native41]::ControlText($input) -ne 'Modern display name'){throw 'Extra edit input readback differs'}
Click $extra 'Apply fields';Start-Sleep -Milliseconds 500
Click $main 'Review changes';Start-Sleep -Milliseconds 900
$report=[Native41]::Top([uint32]$l.pid,'Changes since opening')
$summary=@([Native41]::Children($report)|ForEach-Object{[Native41]::Title($_)}|Where-Object{$_ -match '^1 changes'})
if($summary.Count -ne 1){throw 'Extra edit not shown in review'}
@{pid=$l.pid;utc=[DateTime]::UtcNow.ToString('o');summary=$summary;field='org.openhoops.ui.display_name';value='Modern display name';section=3;row=0;sourceSha256=(Get-FileHash "$r\roster-editor41e\Studio.ROS").Hash;companionSha256=(Get-FileHash "$r\roster-editor41e\Studio.ROS.openhoops.json").Hash}|ConvertTo-Json -Depth 4|Set-Content "$o\ui-extras.json"
