Screenshot testing for Rust games
Repository Cargo Documentation Download
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