winit-test

Crates.iowinit-test
lib.rswinit-test
version0.2.0
sourcesrc
created_at2023-05-19 17:49:02.156805
updated_at2023-11-11 18:09:41.551505
descriptionRun tests using the winit event loop
homepagehttps://github.com/notgull/winit-test
repositoryhttps://github.com/notgull/winit-test
max_upload_size
id869014
size66,029
Winit (github:rust-windowing:winit)

documentation

https://docs.rs/winit-test

README

winit-test

winit-test provides a simple test harness for testing winit applications.

How to Use

Add your test to Cargo.toml with the harness = false option. This will prevent Rust's default test harness from running your test.

[[test]]
name = "my_test"
path = "tests/my_test.rs"
harness = false

Then, in your test, use the winit_test::main! macro to run your tests. The tests must be functions that take an EventLoopWindowTarget.

use winit_test::winit::event_loop::EventLoopWindowTarget;

fn my_test(elwt: &EventLoopWindowTarget<()>) {
    // ...
}

fn other_test(elwt: &EventLoopWindowTarget<()>) {
    // ...
}

winit_test::main!(my_test, other_test);

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Commit count: 17

cargo fmt