Crates.io | xray |
lib.rs | xray |
version | 0.1.1 |
source | src |
created_at | 2018-06-23 00:30:03.519798 |
updated_at | 2018-06-23 00:52:45.968883 |
description | Screenshot testing for Rust games |
homepage | |
repository | https://gitlab.com/tonyfinn/xray |
max_upload_size | |
id | 71327 |
size | 34,882 |
Screenshot testing for Rust games
Example test (for a Piston + OpenGL app):
#[test]
fn check_basic_screen() {
let size = [1280, 720];
let mut app = App::new(size, build_glutin_window(size));
let Size { width: draw_width, height: draw_height } = app.window.draw_size();
let Size { width, height } = app.window.size();
app.render_into_viewport(Viewport {
rect: [0, 0, draw_width as i32, draw_height as i32],
window_size: [width, height],
draw_size: [draw_width, draw_height]
});
xray::screenshot_test("basic_rendering/initial_map", 0, 0, draw_width, draw_height);
}
test_output/<test_name>/actual.png
.references/<test_name>.png
test_output/<test_name>/actual.png
-> Containing the screenshot taken
during the test.test_output/<test_name>/expected.png
-> Containing the reference image
the screenshot was compared against.test_output/<test_name>/diff.png
-> Containing only those pixels which
are different.