A collection of small test programs for the miniquad graphics engine. Note that these are mostly AI generated, so I can't take much credit for them.
Each test is a standalone binary executable.
| Binary | Description |
|---|---|
window |
Tests basic window creation and lifecycle management. Verifies that a window can be created, displayed, and properly responds to close events. |
input |
Tests keyboard and mouse input handling. Verifies that key presses, mouse movement, and clicks are detected and processed correctly. |
graphics |
Tests basic graphics rendering. Draws simple shapes to verify that the rendering pipeline works correctly. |
mouse |
Tests mouse input by drawing white pixels while the left mouse button is held down and moved across the window. |
wireframe |
Renders a rotating 3D wireframe cube using PrimitiveType::Lines. You should see a green wireframe cube rotating on a black background. |
starfield |
Renders an animated starfield using PrimitiveType::Points with dynamic vertex buffer updates (BufferUsage::Stream). You should see white stars streaming toward you on a dark background. |
viewport |
Renders a colour-shaded triangle inside a restricted viewport centred in the window using apply_viewport. A light grey rectangle is drawn around the viewport border so its bounds are clearly visible. |
scrolltext |
Renders white text scrolling smoothly from right to left on a black background. Demonstrates texture creation from raw pixel data, a bitmap font, and delta-time animation. |
files_dropped |
Demonstrates the files_dropped_event callback. Drag one or more files onto the window to see their paths displayed in white on a black background using a scaled bitmap font. |
Run any test with:
cargo run --bin <binary_name>To build all test programs at once:
cargo build --binsEdit Cargo.toml to change the miniquad dependency. Options:
- Main branch:
branch = "main" - Specific commit:
rev = "abc1234def567" - Specific version from crates.io:
version = "0.4" - Local path:
path = "/path/to/miniquad"
After changing the dependency, run:
cargo clean
cargo build --binsminiquad-tests/
├── Cargo.toml # Package manifest with miniquad dependency
├── README.md # This file
├── .gitignore # Git ignore rules
├── src/
│ ├── lib.rs # Shared test utilities and helpers
│ └── bin/
│ ├── window.rs # Window creation and lifecycle test
│ ├── input.rs # Input handling test
│ ├── graphics.rs # Graphics rendering test
│ ├── mouse.rs # Mouse drawing test
│ ├── wireframe.rs # Rotating 3D wireframe cube test
│ ├── starfield.rs # Animated starfield test
│ ├── viewport.rs # Shaded triangle in a centred sub-viewport test
│ ├── scrolltext.rs # Scrolling white text on black background test
│ └── files_dropped.rs # Files-dropped event and bitmap-font display test
- Create a new
.rsfile insrc/bin/, e.g.,src/bin/my_test.rs - Add a
[[bin]]entry inCargo.tomlpointing to the new file - Implement your test using the shared utilities from
src/lib.rs - Run with
cargo run --bin my_test
Common functions and helpers are defined in src/lib.rs to avoid code duplication. Import them in your test binaries:
use miniquad_test_utils::*;- Rust 1.70+ (check your version with
rustc --version) - Platform-specific miniquad dependencies (see miniquad docs)
Build fails with dependency errors: Ensure you have the latest Rust toolchain:
rustup updateTest window doesn't appear: Check your graphics drivers and ensure your platform supports the graphics backend (Metal on macOS, DirectX on Windows, GL on Linux).
Cargo.lock conflicts:
The Cargo.lock file is committed to ensure reproducible builds. If you're testing different miniquad branches, run:
cargo updateThese test programs are provided as examples for testing miniquad. See the miniquad repository for its license.