aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authortomaka <pierre.krieger1708@gmail.com>2014-10-11 20:54:07 +0200
committertomaka <pierre.krieger1708@gmail.com>2014-10-11 20:54:07 +0200
commit32a6c7f1e9e68757542a5faef8382b8b01ca0d29 (patch)
treee5267b37dd91d118fb38cd447ef407cc6a63dd76 /tests
parent9e9a3ae03a96593de9b81948a347da1a41c7c1a6 (diff)
parentc71625e301311d2efc6c53c3b13927cfe1e7ec55 (diff)
downloadglutin-32a6c7f1e9e68757542a5faef8382b8b01ca0d29.tar.gz
glutin-32a6c7f1e9e68757542a5faef8382b8b01ca0d29.zip
Merge pull request #51 from tomaka/headless-test
Add test for headless rendering
Diffstat (limited to 'tests')
-rw-r--r--tests/headless.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/headless.rs b/tests/headless.rs
index b9ae598..ffc74b3 100644
--- a/tests/headless.rs
+++ b/tests/headless.rs
@@ -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));
}