Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions windows/BUILD_AND_TEST.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,51 @@ This document provides detailed instructions for building and testing LibrePods

## Testing

### Automated System Requirements Test Suite

Before manually testing the application, you can run the automated test suite to verify your system meets all requirements:

#### Building the Tests

```powershell
# Navigate to the windows directory
cd path\to\librepods-windows\windows

# Create build directory if it doesn't exist
mkdir build
cd build

# Configure with tests enabled (add -DBUILD_TESTS=ON)
cmake .. -DBUILD_TESTS=ON -DCMAKE_TOOLCHAIN_FILE="C:/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake"

# Build both the application and tests
cmake --build . --config Release
```

#### Running the Tests

```powershell
# Option 1: Run all tests with CTest
ctest -C Release --verbose

# Option 2: Run the test executable directly
cd tests\Release
.\test_system_requirements.exe
```

#### What the Tests Check

The system requirements test suite verifies:
- ✓ Windows version (Windows 10 build 17763/1809 or later, or Windows 11)
- ✓ Bluetooth adapter presence
- ✓ Bluetooth is enabled
- ✓ BLE (Bluetooth Low Energy) support
- ✓ Qt6 version (6.2 or later)
- ✓ Required Qt6 modules (Quick, Widgets, Bluetooth, Multimedia)
- ✓ OpenSSL support for encrypted communication

See [tests/README.md](tests/README.md) for detailed information about the test suite.

### Manual Testing Checklist

#### 1. Initial Launch
Expand Down
7 changes: 7 additions & 0 deletions windows/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ set_target_properties(librepods-windows PROPERTIES
WIN32_EXECUTABLE TRUE
)

# Optional: Build test suite
option(BUILD_TESTS "Build test suite" OFF)
if(BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()

# Installation
include(GNUInstallDirs)
install(TARGETS librepods-windows
Expand Down
26 changes: 26 additions & 0 deletions windows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,32 @@ A native Windows application to control your AirPods, with support for:

## Prerequisites

### Check System Requirements

Before installing, you can verify your system meets all requirements using our automated test suite:

```powershell
# Clone the repository
git clone https://github.com/Tblob18/librepods-windows.git
cd librepods-windows/windows

# Run the system requirements test
# Option 1: With vcpkg
.\run_tests.ps1 -VcpkgPath "C:\path\to\vcpkg"

# Option 2: With manually installed Qt
.\run_tests.ps1 -QtPath "C:\Qt\6.x.x\msvc2019_64"
```

The test will verify:
- Windows version compatibility (Windows 10 1809+ or Windows 11)
- Bluetooth adapter presence and status
- BLE (Bluetooth Low Energy) support
- Qt6 version and required modules
- OpenSSL availability

See [tests/README.md](tests/README.md) for more details.

### Required Software

1. **Visual Studio Build Tools** (Required for vcpkg)
Expand Down
132 changes: 132 additions & 0 deletions windows/run_tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# LibrePods Windows - System Requirements Test Runner
# This script builds and runs the system requirements test suite

param(
[string]$VcpkgPath = "",
[string]$QtPath = "",
[switch]$SkipBuild = $false,
[switch]$Verbose = $false
)

Write-Host "=== LibrePods Windows - System Requirements Test ===" -ForegroundColor Cyan
Write-Host ""

# Determine if we're already in a build directory
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$testsDir = Join-Path $scriptDir "tests"
$buildDir = Join-Path $testsDir "build"

# Check if test directory exists
if (-not (Test-Path $testsDir)) {
Write-Host "Error: Tests directory not found at $testsDir" -ForegroundColor Red
Write-Host "Please run this script from the windows directory" -ForegroundColor Red
exit 1
}

# Create build directory if it doesn't exist
if (-not (Test-Path $buildDir)) {
Write-Host "Creating build directory..." -ForegroundColor Yellow
New-Item -ItemType Directory -Path $buildDir | Out-Null
}

Set-Location $buildDir

if (-not $SkipBuild) {
Write-Host "Building tests..." -ForegroundColor Yellow
Write-Host ""

# Prepare CMake command
$cmakeConfigArgs = @("..")

if ($VcpkgPath -ne "") {
$toolchainFile = Join-Path $VcpkgPath "scripts\buildsystems\vcpkg.cmake"
if (Test-Path $toolchainFile) {
Write-Host "Using vcpkg toolchain: $toolchainFile" -ForegroundColor Green
$cmakeConfigArgs += "-DCMAKE_TOOLCHAIN_FILE=$toolchainFile"
} else {
Write-Host "Warning: vcpkg toolchain file not found at $toolchainFile" -ForegroundColor Yellow
}
} elseif ($QtPath -ne "") {
if (Test-Path $QtPath) {
Write-Host "Using Qt path: $QtPath" -ForegroundColor Green
$cmakeConfigArgs += "-DCMAKE_PREFIX_PATH=$QtPath"
} else {
Write-Host "Warning: Qt path not found at $QtPath" -ForegroundColor Yellow
}
} else {
Write-Host "No vcpkg or Qt path specified, using system defaults" -ForegroundColor Yellow
Write-Host "If configuration fails, provide -VcpkgPath or -QtPath" -ForegroundColor Yellow
}

# Configure
Write-Host ""
Write-Host "Configuring CMake..." -ForegroundColor Yellow
& cmake @cmakeConfigArgs

if ($LASTEXITCODE -ne 0) {
Write-Host ""
Write-Host "Error: CMake configuration failed!" -ForegroundColor Red
Write-Host ""
Write-Host "Try running with vcpkg:" -ForegroundColor Yellow
Write-Host " .\run_tests.ps1 -VcpkgPath 'C:\path\to\vcpkg'" -ForegroundColor Cyan
Write-Host ""
Write-Host "Or with Qt:" -ForegroundColor Yellow
Write-Host " .\run_tests.ps1 -QtPath 'C:\Qt\6.x.x\msvc2019_64'" -ForegroundColor Cyan
exit 1
}

# Build
Write-Host ""
Write-Host "Building..." -ForegroundColor Yellow
& cmake --build . --config Release

if ($LASTEXITCODE -ne 0) {
Write-Host ""
Write-Host "Error: Build failed!" -ForegroundColor Red
exit 1
}

Write-Host ""
Write-Host "Build completed successfully!" -ForegroundColor Green
}

# Run tests
Write-Host ""
Write-Host "=== Running System Requirements Tests ===" -ForegroundColor Cyan
Write-Host ""

$testExe = Join-Path $buildDir "Release\test_system_requirements.exe"

if (-not (Test-Path $testExe)) {
# Try Debug build
$testExe = Join-Path $buildDir "Debug\test_system_requirements.exe"
if (-not (Test-Path $testExe)) {
Write-Host "Error: Test executable not found!" -ForegroundColor Red
Write-Host "Expected location: $testExe" -ForegroundColor Red
exit 1
}
}

Write-Host "Running: $testExe" -ForegroundColor Yellow
Write-Host ""

# Run the test executable
& $testExe

$testResult = $LASTEXITCODE

Write-Host ""
Write-Host "================================================" -ForegroundColor Cyan

if ($testResult -eq 0) {
Write-Host "✓ All tests passed!" -ForegroundColor Green
Write-Host "Your system meets all requirements for LibrePods Windows" -ForegroundColor Green
} else {
Write-Host "✗ Some tests failed" -ForegroundColor Red
Write-Host "Please review the output above to see which requirements are not met" -ForegroundColor Yellow
}

Write-Host "================================================" -ForegroundColor Cyan
Write-Host ""

exit $testResult
29 changes: 29 additions & 0 deletions windows/tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Build directories
build/
build-*/

# CMake generated files
CMakeCache.txt
CMakeFiles/
cmake_install.cmake
CTestTestfile.cmake
Testing/

# Test executables
test_system_requirements
test_system_requirements.exe

# Qt MOC files
*.moc
moc_*.cpp

# Compiled objects
*.o
*.obj

# IDE files
.vs/
.vscode/
*.user
*.suo
*.sln.docstates
52 changes: 52 additions & 0 deletions windows/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
cmake_minimum_required(VERSION 3.16)

# Test suite for LibrePods Windows
project(librepods-tests)

# Enable testing
enable_testing()

# Find required packages
find_package(Qt6 REQUIRED COMPONENTS Test Bluetooth Network)

# System Requirements Test
add_executable(test_system_requirements
test_system_requirements.cpp
)

target_link_libraries(test_system_requirements
PRIVATE
Qt6::Test
Qt6::Bluetooth
Qt6::Network
)

# Add test to CTest
add_test(NAME SystemRequirements COMMAND test_system_requirements)

# Set test properties
set_tests_properties(SystemRequirements PROPERTIES
TIMEOUT 60
LABELS "requirements;system"
)

# On Windows, link additional libraries
if(WIN32)
target_link_libraries(test_system_requirements
PRIVATE
ws2_32
Bthprops
)
endif()

# Installation (optional - tests are usually not installed)
# Uncomment if you want to install test executables
# install(TARGETS test_system_requirements
# RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}/tests
# )

# Print test configuration info only in verbose mode
if(CMAKE_VERBOSE_MAKEFILE OR DEFINED ENV{VERBOSE})
message(STATUS "Test suite configured successfully")
message(STATUS "Run 'ctest' or 'ctest --verbose' to execute tests")
endif()
Loading