aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-05-14 18:07:54 +0200
committerMattias Andrée <maandree@operamail.com>2015-05-14 18:07:54 +0200
commitaf7482493ff16065a7ecea213e8b00e9a7198c9b (patch)
treec0dce4b89e1ef6d85cad0d48b8ba402aeeeeafa2
parenttest: add an error check just to be safe (diff)
downloadlibgamma-af7482493ff16065a7ecea213e8b00e9a7198c9b.tar.gz
libgamma-af7482493ff16065a7ecea213e8b00e9a7198c9b.tar.bz2
libgamma-af7482493ff16065a7ecea213e8b00e9a7198c9b.tar.xz
test: test ramp order
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--src/test/test.c24
-rw-r--r--src/test/test.h1
2 files changed, 25 insertions, 0 deletions
diff --git a/src/test/test.c b/src/test/test.c
index 30d2952..d387a3c 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -136,6 +136,30 @@ int main(void)
#undef Y
#undef X
+ /* Test order of gamma ramps. */
+ memcpy(ramps16.red, old_ramps16.red, ramps16.red_size * sizeof(uint16_t));
+ memset(ramps16.green, 0, ramps16.green_size * sizeof(uint16_t));
+ memset(ramps16.blue, 0, ramps16.blue_size * sizeof(uint16_t));
+ printf("Making the monitor red-only for 1 second...\n");
+ if ((rr |= r = libgamma_crtc_set_gamma_ramps16(crtc_state, ramps16)))
+ libgamma_perror("libgamma_crtc_set_gamma_ramps16", r);
+ sleep(1);
+ memset(ramps16.red, 0, ramps16.red_size * sizeof(uint16_t));
+ memcpy(ramps16.green, old_ramps16.green, ramps16.green_size * sizeof(uint16_t));
+ printf("Making the monitor green-only for 1 second...\n");
+ if ((rr |= r = libgamma_crtc_set_gamma_ramps16(crtc_state, ramps16)))
+ libgamma_perror("libgamma_crtc_set_gamma_ramps16", r);
+ sleep(1);
+ memset(ramps16.green, 0, ramps16.green_size * sizeof(uint16_t));
+ memcpy(ramps16.blue, old_ramps16.blue, ramps16.blue_size * sizeof(uint16_t));
+ printf("Making the monitor green-only for 1 second...\n");
+ if ((rr |= r = libgamma_crtc_set_gamma_ramps16(crtc_state, ramps16)))
+ libgamma_perror("libgamma_crtc_set_gamma_ramps16", r);
+ sleep(1);
+ if ((rr |= r = libgamma_crtc_set_gamma_ramps64(crtc_state, old_ramps64)))
+ libgamma_perror("libgamma_crtc_set_gamma_ramps64", r);
+ printf("Done!\n");
+
/* TODO Test gamma ramp restore functions. */
done:
diff --git a/src/test/test.h b/src/test/test.h
index 62cda4c..0c22fe0 100644
--- a/src/test/test.h
+++ b/src/test/test.h
@@ -32,6 +32,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <stdint.h>
+#include <string.h>
#endif