# Testing Documentation ## Overview Yakety uses manual interactive tests for GUI components and dialog validation. All test programs are located in `/src/tests/` and test specific platform dialog implementations using the app's GUI framework integration. **Test File Locations:** `/src/tests/test_*.c` ## Test Types ### Dialog Integration Tests Manual GUI tests that validate platform-specific dialog implementations: - **`/src/tests/test_model_dialog.c`** - Models & Language selection dialog - **`/src/tests/test_keycombination_dialog.c`** - Hotkey capture dialog with keylogger integration - **`/src/tests/test_download_dialog.c`** - Model download progress dialog ### Test Structure All tests follow this pattern: - Initialize platform app framework (`app_init`) - Set up test-specific dependencies (keylogger, callbacks) - Execute dialog function with test parameters - Validate results and clean up resources - Exit with status code ## Running Tests ### Prerequisites ```bash # Configure and build project first cmake --preset release # or debug cmake --build --preset release ``` ### Test Execution Commands **Model Dialog Test:** ```bash ./build/bin/test-model-dialog ``` Expected: GUI dialog opens for model/language selection, prints selected values or cancellation. **Key Combination Dialog Test:** ```bash ./build/bin/test-keycombination-dialog ``` Expected: GUI dialog captures key combinations, prints key codes and modifier flags. **Download Dialog Test:** ```bash ./build/bin/test-download-dialog ``` Expected: Downloads test file (1KB from httpbin.org), shows progress dialog, cleans up temp file. ### Platform Availability Tests are only built and available on **macOS** (requires Cocoa/SwiftUI frameworks). Windows tests would require separate implementations using platform-specific dialog APIs. ## Reference ### Test File Organization ``` src/tests/ ├── test_model_dialog.c # Model selection dialog test ├── test_keycombination_dialog.c # Hotkey capture dialog test └── test_download_dialog.c # Download progress dialog test ``` ### CMake Test Targets Test executables are defined in `/CMakeLists.txt` lines 502-532: ```cmake # Test programs (macOS only) add_executable(test-model-dialog src/tests/test_model_dialog.c) add_executable(test-keycombination-dialog src/tests/test_keycombination_dialog.c) add_executable(test-download-dialog src/tests/test_download_dialog.c) ``` ### Test Dependencies - **Platform library:** Core app and dialog functions - **Cocoa framework:** macOS GUI integration (-framework Cocoa) - **SwiftUI framework:** Modern dialog implementations (-framework SwiftUI) - **Keylogger:** Required for hotkey capture testing ### Test Output Location All test executables built to: `/build/bin/test-*` ### Creating New Tests 1. Add test source file in `/src/tests/test_.c` 2. Follow existing test pattern with `app_init`, test logic, `app_cleanup` 3. Add CMake target in main `/CMakeLists.txt` (macOS section) 4. Link required platform libraries and frameworks 5. Ensure proper cleanup and exit codes for automation