mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-23 22:01:31 +11:00
Add test for headless rendering
This commit is contained in:
parent
cdee854d2e
commit
c71625e301
|
@ -1,7 +1,14 @@
|
|||
#![feature(phase)]
|
||||
#![feature(tuple_indexing)]
|
||||
|
||||
#[phase(plugin)]
|
||||
extern crate gl_generator;
|
||||
extern crate glutin;
|
||||
extern crate libc;
|
||||
|
||||
mod gl {
|
||||
generate_gl_bindings!("gl", "core", "1.1", "struct")
|
||||
}
|
||||
|
||||
#[cfg(feature = "headless")]
|
||||
#[test]
|
||||
|
@ -10,4 +17,13 @@ fn main() {
|
|||
|
||||
unsafe { window.make_current() };
|
||||
|
||||
let gl = gl::Gl::load_with(|symbol| window.get_proc_address(symbol));
|
||||
|
||||
gl.ClearColor(0.0, 1.0, 0.0, 1.0);
|
||||
gl.Clear(gl::COLOR_BUFFER_BIT);
|
||||
|
||||
let mut value: (u8, u8, u8, u8) = unsafe { std::mem::uninitialized() };
|
||||
unsafe { gl.ReadPixels(0, 0, 1, 1, gl::RGBA, gl::UNSIGNED_BYTE, std::mem::transmute(&mut value)) };
|
||||
|
||||
assert_eq!(value, (0, 255, 0, 255));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue