param( [int]$Key ) # Interactive launcher for the manual KEY1-KEY6 UI regression scenarios. $ErrorActionPreference = 'Stop' $root = Split-Path -Parent $PSScriptRoot $project = Join-Path $root 'imGui-easyX.vcxproj' $executable = Join-Path $root 'build\x64\Debug\imGui-easyX.exe' $msbuild = if ($env:STELLARX_MSBUILD) { $env:STELLARX_MSBUILD } else { 'D:\vs2022\MSBuild\Current\Bin\MSBuild.exe' } $hasKeyArgument = $PSBoundParameters.ContainsKey('Key') function Show-KeyMenu { Write-Host '' Write-Host 'StellarX manual UI regression scenarios' Write-Host ' 1 - TabControl and Table redraw' Write-Host ' 2 - Layout, resize, and bit operations' Write-Host ' 3 - Legacy application smoke test' Write-Host ' 4 - Dialog and MessageBox behavior' Write-Host ' 5 - Nested Canvas, Tooltip, and overlay redraw' Write-Host ' 6 - Shape hit-test and uncovered branches' Write-Host ' 0 - Exit' Write-Host '' } function Invoke-KeyScenario([int]$scenario) { if ($scenario -lt 1 -or $scenario -gt 6) { throw "KEY must be an integer from 1 to 6: $scenario" } if (-not (Test-Path -LiteralPath $msbuild)) { throw "MSBuild not found: $msbuild" } if (-not (Test-Path -LiteralPath $project)) { throw "Project not found: $project" } Write-Host "Building KEY$scenario (Debug|x64)..." -ForegroundColor Cyan & $msbuild $project /m /t:Rebuild /p:Configuration=Debug /p:Platform=x64 /p:KeyScenario=$scenario /p:EnableAsan=false /v:minimal if ($LASTEXITCODE -ne 0) { throw "KEY$scenario build failed with exit code $LASTEXITCODE." } if (-not (Test-Path -LiteralPath $executable)) { throw "Built executable not found: $executable" } Write-Host "Launching KEY$scenario. Close the UI window to return to the menu." -ForegroundColor Green $process = Start-Process -FilePath $executable -WorkingDirectory $root -PassThru -Wait if ($process.ExitCode -ne 0) { throw "KEY$scenario exited with code $($process.ExitCode)." } } if ($hasKeyArgument) { try { Invoke-KeyScenario $Key exit 0 } catch { [Console]::Error.WriteLine("ERROR: $($_.Exception.Message)") exit 1 } } while ($true) { Show-KeyMenu $rawSelection = Read-Host 'Select a KEY scenario' $selection = -1 if (-not [int]::TryParse($rawSelection, [ref]$selection) -or $selection -lt 0 -or $selection -gt 6) { Write-Host 'Invalid selection. Enter a number from 0 to 6.' -ForegroundColor Yellow continue } if ($selection -eq 0) { exit 0 } try { Invoke-KeyScenario $selection } catch { Write-Host "ERROR: $($_.Exception.Message)" -ForegroundColor Red } }