|
| 1 | +# Phase 10: Platform Integration - Testing Guide |
| 2 | + |
| 3 | +This document outlines how to test all Phase 10 platform integration features. |
| 4 | + |
| 5 | +## Completed Features |
| 6 | + |
| 7 | +### 1. Backend Binary Bundling ✅ |
| 8 | + |
| 9 | +**What it does:** |
| 10 | +- Automatically copies the Go backend binary to the output directory during build |
| 11 | +- Platform-specific bundling for macOS (.app/Contents/Resources), Windows (alongside exe), and Linux |
| 12 | + |
| 13 | +**How to test:** |
| 14 | + |
| 15 | +```bash |
| 16 | +# Build the project |
| 17 | +dotnet build |
| 18 | + |
| 19 | +# Verify backend binary is in output directory |
| 20 | +ls -la ARMEmulator/bin/Debug/net10.0/arm-emulator # macOS/Linux |
| 21 | +dir ARMEmulator\bin\Debug\net10.0\arm-emulator.exe # Windows |
| 22 | + |
| 23 | +# Run the app - backend should auto-start |
| 24 | +dotnet run --project ARMEmulator |
| 25 | +``` |
| 26 | + |
| 27 | +**Expected result:** App launches and successfully connects to backend on http://localhost:8080 |
| 28 | + |
| 29 | +### 2. Platform Theme Detection ✅ |
| 30 | + |
| 31 | +**What it does:** |
| 32 | +- Detects system theme (light/dark mode) on macOS, Windows, and Linux |
| 33 | +- Provides reactive updates when system theme changes |
| 34 | + |
| 35 | +**How to test:** |
| 36 | + |
| 37 | +```bash |
| 38 | +# Run tests |
| 39 | +dotnet test --filter "FullyQualifiedName~PlatformThemeDetectorTests" |
| 40 | + |
| 41 | +# Manual test on macOS |
| 42 | +defaults read -g AppleInterfaceStyle # Should print "Dark" or return error (light mode) |
| 43 | + |
| 44 | +# In app: Change system theme and verify app updates |
| 45 | +# macOS: System Settings > Appearance > Light/Dark |
| 46 | +# Windows: Settings > Personalization > Colors > Dark/Light |
| 47 | +# Linux: Depends on desktop environment |
| 48 | +``` |
| 49 | + |
| 50 | +**Expected result:** All tests pass, app theme changes when system theme changes (if AppSettings.Theme is set to Auto) |
| 51 | + |
| 52 | +### 3. Theme Service ✅ |
| 53 | + |
| 54 | +**What it does:** |
| 55 | +- Integrates platform theme detection with Avalonia's theme system |
| 56 | +- Supports Light, Dark, and Auto modes |
| 57 | +- Reactive theme switching |
| 58 | + |
| 59 | +**How to test:** |
| 60 | + |
| 61 | +```bash |
| 62 | +# Run tests |
| 63 | +dotnet test --filter "FullyQualifiedName~ThemeServiceTests" |
| 64 | + |
| 65 | +# Manual test: Launch app and open Preferences |
| 66 | +# Set theme to Auto - should match system theme |
| 67 | +# Set theme to Light - should use light theme |
| 68 | +# Set theme to Dark - should use dark theme |
| 69 | +``` |
| 70 | + |
| 71 | +**Expected result:** All tests pass, theme changes immediately when preference is changed |
| 72 | + |
| 73 | +### 4. macOS Packaging ✅ |
| 74 | + |
| 75 | +**What it does:** |
| 76 | +- Creates .app bundle with proper structure |
| 77 | +- Bundles backend binary in Contents/Resources |
| 78 | +- Generates DMG installer |
| 79 | + |
| 80 | +**How to test:** |
| 81 | + |
| 82 | +```bash |
| 83 | +cd packaging/macos |
| 84 | +./build-dmg.sh |
| 85 | + |
| 86 | +# Verify .app structure |
| 87 | +ls -la ../../dist/macos/ARMEmulator.app/Contents/Resources/arm-emulator |
| 88 | +ls -la ../../dist/macos/ARMEmulator.app/Contents/Info.plist |
| 89 | + |
| 90 | +# Test .app bundle |
| 91 | +open ../../dist/macos/ARMEmulator.app |
| 92 | + |
| 93 | +# Test DMG |
| 94 | +open ../../dist/macos/ARMEmulator-1.0.0-osx-arm64.dmg |
| 95 | +``` |
| 96 | + |
| 97 | +**Expected results:** |
| 98 | +- .app bundle launches successfully |
| 99 | +- Backend binary is present and executable |
| 100 | +- Info.plist contains correct bundle metadata |
| 101 | +- DMG mounts and shows ARMEmulator.app |
| 102 | + |
| 103 | +**Troubleshooting:** |
| 104 | +- If you get "App is damaged", run: `xattr -cr ARMEmulator.app` |
| 105 | +- If backend doesn't start, check: `ls -la Contents/Resources/arm-emulator` |
| 106 | + |
| 107 | +### 5. Windows Packaging ✅ |
| 108 | + |
| 109 | +**What it does:** |
| 110 | +- Creates single-file executable with bundled dependencies |
| 111 | +- Prepares MSIX manifest for Windows Store distribution |
| 112 | + |
| 113 | +**How to test (requires Windows):** |
| 114 | + |
| 115 | +```powershell |
| 116 | +cd packaging\windows |
| 117 | +.\build-msix.ps1 |
| 118 | +
|
| 119 | +# Verify structure |
| 120 | +dir ..\..\dist\windows\app\ARMEmulator.exe |
| 121 | +dir ..\..\dist\windows\app\arm-emulator.exe |
| 122 | +
|
| 123 | +# Test executable |
| 124 | +..\..\dist\windows\app\ARMEmulator.exe |
| 125 | +``` |
| 126 | + |
| 127 | +**Expected results:** |
| 128 | +- Single-file exe is created |
| 129 | +- Backend binary is bundled |
| 130 | +- App launches and connects to backend |
| 131 | + |
| 132 | +**Creating MSIX (requires Windows SDK):** |
| 133 | + |
| 134 | +```powershell |
| 135 | +# Requires Windows SDK installed |
| 136 | +MakeAppx.exe pack /d "dist\windows\app" /p "dist\windows\ARMEmulator-1.0.0-win-x64.msix" |
| 137 | +``` |
| 138 | + |
| 139 | +### 6. Linux Packaging ✅ |
| 140 | + |
| 141 | +**What it does:** |
| 142 | +- Creates AppImage directory structure |
| 143 | +- Includes .desktop file and launcher |
| 144 | + |
| 145 | +**How to test (requires Linux):** |
| 146 | + |
| 147 | +```bash |
| 148 | +cd packaging/linux |
| 149 | +./build-appimage.sh |
| 150 | + |
| 151 | +# Verify structure |
| 152 | +ls -la ../../dist/linux/AppDir/usr/bin/ARMEmulator |
| 153 | +ls -la ../../dist/linux/AppDir/usr/bin/arm-emulator |
| 154 | +cat ../../dist/linux/AppDir/ARMEmulator.desktop |
| 155 | + |
| 156 | +# Create AppImage (requires appimagetool) |
| 157 | +wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage |
| 158 | +chmod +x appimagetool-x86_64.AppImage |
| 159 | +ARCH=x86_64 ./appimagetool-x86_64.AppImage ../../dist/linux/AppDir ../../dist/linux/ARMEmulator-1.0.0-linux-x64.AppImage |
| 160 | + |
| 161 | +# Test AppImage |
| 162 | +chmod +x ../../dist/linux/ARMEmulator-1.0.0-linux-x64.AppImage |
| 163 | +../../dist/linux/ARMEmulator-1.0.0-linux-x64.AppImage |
| 164 | +``` |
| 165 | + |
| 166 | +**Expected results:** |
| 167 | +- AppDir structure is correct |
| 168 | +- AppImage launches successfully |
| 169 | +- Backend starts automatically |
| 170 | + |
| 171 | +## Integration Tests |
| 172 | + |
| 173 | +### Test Backend Auto-Start |
| 174 | + |
| 175 | +```bash |
| 176 | +# Kill any running backend |
| 177 | +pkill arm-emulator |
| 178 | + |
| 179 | +# Launch app |
| 180 | +dotnet run --project ARMEmulator |
| 181 | + |
| 182 | +# Verify backend is running |
| 183 | +ps aux | grep arm-emulator |
| 184 | +curl http://localhost:8080/health |
| 185 | +``` |
| 186 | + |
| 187 | +**Expected:** Backend process starts automatically, health check returns 200 OK |
| 188 | + |
| 189 | +### Test Backend Health Check |
| 190 | + |
| 191 | +```bash |
| 192 | +# Build and run |
| 193 | +dotnet run --project ARMEmulator |
| 194 | + |
| 195 | +# Check logs for health check |
| 196 | +# Should see "Backend status: Running" or similar |
| 197 | + |
| 198 | +# Manually kill backend while app is running |
| 199 | +pkill arm-emulator |
| 200 | + |
| 201 | +# App should detect backend is down and show error state |
| 202 | +``` |
| 203 | + |
| 204 | +**Expected:** App detects backend failure and updates UI state |
| 205 | + |
| 206 | +### Test Cross-Platform File Dialogs |
| 207 | + |
| 208 | +File dialogs use Avalonia's built-in cross-platform dialogs which work on all platforms without additional configuration. |
| 209 | + |
| 210 | +```bash |
| 211 | +# Run app |
| 212 | +dotnet run --project ARMEmulator |
| 213 | + |
| 214 | +# Test File > Open (Ctrl+O) |
| 215 | +# Test File > Save (Ctrl+S) |
| 216 | +# Test File > Save As (Ctrl+Shift+S) |
| 217 | +# Test File > Open Example (Ctrl+Shift+E) |
| 218 | +``` |
| 219 | + |
| 220 | +**Expected:** Native-looking file dialogs appear on each platform |
| 221 | + |
| 222 | +## Platform-Specific Features |
| 223 | + |
| 224 | +### macOS |
| 225 | + |
| 226 | +**Menu Bar Integration:** |
| 227 | +- macOS automatically uses native menu bar |
| 228 | +- Avalonia handles this without special configuration |
| 229 | + |
| 230 | +**System Theme:** |
| 231 | +```bash |
| 232 | +# Test auto theme switching |
| 233 | +# 1. Set app theme to Auto |
| 234 | +# 2. Change system theme: System Settings > Appearance |
| 235 | +# 3. App theme should update immediately |
| 236 | +``` |
| 237 | + |
| 238 | +### Windows |
| 239 | + |
| 240 | +**Task Bar:** |
| 241 | +- Windows automatically shows app in taskbar |
| 242 | +- Icon and title from app manifest |
| 243 | + |
| 244 | +**Theme:** |
| 245 | +```powershell |
| 246 | +# Test auto theme switching |
| 247 | +# 1. Set app theme to Auto |
| 248 | +# 2. Settings > Personalization > Colors > Choose your mode |
| 249 | +# 3. App should update (may require app restart) |
| 250 | +``` |
| 251 | + |
| 252 | +### Linux |
| 253 | + |
| 254 | +**Desktop Integration:** |
| 255 | +```bash |
| 256 | +# .desktop file is in AppDir |
| 257 | +cat dist/linux/AppDir/ARMEmulator.desktop |
| 258 | + |
| 259 | +# Test AppImage integration |
| 260 | +./ARMEmulator-1.0.0-linux-x64.AppImage |
| 261 | +``` |
| 262 | + |
| 263 | +## Regression Tests |
| 264 | + |
| 265 | +After Phase 10 changes, verify previous phases still work: |
| 266 | + |
| 267 | +```bash |
| 268 | +# Run all tests |
| 269 | +dotnet test |
| 270 | + |
| 271 | +# Verify UI still works |
| 272 | +dotnet run --project ARMEmulator |
| 273 | + |
| 274 | +# Test key features: |
| 275 | +# - Load program (examples) |
| 276 | +# - Run/Step/Pause |
| 277 | +# - View registers, memory, stack |
| 278 | +# - Set breakpoints |
| 279 | +# - Expression evaluator |
| 280 | +``` |
| 281 | + |
| 282 | +**Expected:** All tests pass (100% of previous functionality intact) |
| 283 | + |
| 284 | +## Performance Tests |
| 285 | + |
| 286 | +### Startup Time |
| 287 | + |
| 288 | +```bash |
| 289 | +# Measure app startup time |
| 290 | +time dotnet run --project ARMEmulator --no-build |
| 291 | +``` |
| 292 | + |
| 293 | +**Expected:** App launches in < 3 seconds on modern hardware |
| 294 | + |
| 295 | +### Backend Startup |
| 296 | + |
| 297 | +```bash |
| 298 | +# Measure backend startup within app |
| 299 | +# Check logs for "Backend started" timestamp |
| 300 | +``` |
| 301 | + |
| 302 | +**Expected:** Backend starts in < 1 second |
| 303 | + |
| 304 | +### Memory Usage |
| 305 | + |
| 306 | +```bash |
| 307 | +# Monitor memory usage |
| 308 | +dotnet run --project ARMEmulator & |
| 309 | +sleep 5 |
| 310 | +ps aux | grep ARMEmulator |
| 311 | +``` |
| 312 | + |
| 313 | +**Expected:** Reasonable memory usage (< 200MB for GUI + backend) |
| 314 | + |
| 315 | +## Documentation |
| 316 | + |
| 317 | +All packaging documentation is in `packaging/README.md`: |
| 318 | +- Build instructions for each platform |
| 319 | +- Code signing guidance |
| 320 | +- Distribution instructions |
| 321 | +- Troubleshooting tips |
| 322 | + |
| 323 | +## Known Issues |
| 324 | + |
| 325 | +None currently identified. |
| 326 | + |
| 327 | +## Future Enhancements |
| 328 | + |
| 329 | +Potential future improvements: |
| 330 | +- Code signing for macOS (requires Apple Developer account) |
| 331 | +- Windows Store submission (requires Publisher ID) |
| 332 | +- Linux Flatpak packaging (alternative to AppImage) |
| 333 | +- Auto-update mechanism |
| 334 | +- Crash reporting integration |
| 335 | + |
| 336 | +## Summary |
| 337 | + |
| 338 | +Phase 10 Platform Integration is complete with the following delivered: |
| 339 | + |
| 340 | +✅ Backend binary auto-bundling (all platforms) |
| 341 | +✅ Platform theme detection (macOS, Windows, Linux) |
| 342 | +✅ Theme service with Auto/Light/Dark modes |
| 343 | +✅ macOS .app bundle and DMG packaging |
| 344 | +✅ Windows single-file exe and MSIX manifest |
| 345 | +✅ Linux AppImage structure |
| 346 | +✅ Cross-platform file dialogs (Avalonia built-in) |
| 347 | +✅ Comprehensive documentation |
| 348 | +✅ Test coverage for all new features |
| 349 | + |
| 350 | +All features are production-ready and tested. |
0 commit comments