diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-05-25 13:14:23 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-05-25 13:15:51 +0200 |
commit | 8c78c7950979ffae1bcdac75e11bd8f18cf320b6 (patch) | |
tree | c48302aa526f82625b0fce315d0e0db8b3e4c126 /test/test.c | |
parent | m + add test that lists adjustment methds (diff) | |
download | libgamma-8c78c7950979ffae1bcdac75e11bd8f18cf320b6.tar.gz libgamma-8c78c7950979ffae1bcdac75e11bd8f18cf320b6.tar.bz2 libgamma-8c78c7950979ffae1bcdac75e11bd8f18cf320b6.tar.xz |
add buf_size parameter tolibgamma_list_methods
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'test/test.c')
-rw-r--r-- | test/test.c | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/test/test.c b/test/test.c index 9dc3b1b..4b499b3 100644 --- a/test/test.c +++ b/test/test.c @@ -18,35 +18,31 @@ #include <libgamma.h> #include <stdio.h> +#include <stdlib.h> int main(void) { - int methods[GAMMA_METHOD_COUNT]; - size_t n = libgamma_list_methods(methods, 0); + int* methods = malloc(GAMMA_METHOD_COUNT * sizeof(int)); + size_t n = libgamma_list_methods(methods, GAMMA_METHOD_COUNT, 0); size_t i; + if (n > GAMMA_METHOD_COUNT) + { + printf("Warning: you should to recompile the program, libgamma has been updated.\n"); + methods = realloc(methods, n * sizeof(int)); + libgamma_list_methods(methods, n, 0); + } + for (i = 0; i < n; i++) switch (methods[i]) { - case GAMMA_METHOD_DUMMY: - printf("dummy\n"); - break; - case GAMMA_METHOD_X_RANDR: - printf("RandR X extension\n"); - break; - case GAMMA_METHOD_X_VIDMODE: - printf("VidMode X extension\n"); - break; - case GAMMA_METHOD_LINUX_DRM: - printf("Linux DRM\n"); - break; - case GAMMA_METHOD_W32_GDI: - printf("Windows GDI\n"); - break; - case GAMMA_METHOD_QUARTZ_CORE_GRAPHICS: - printf("Quartz using Core Graphics\n"); - break; + case GAMMA_METHOD_DUMMY: printf("dummy\n"); break; + case GAMMA_METHOD_X_RANDR: printf("RandR X extension\n"); break; + case GAMMA_METHOD_X_VIDMODE: printf("VidMode X extension\n"); break; + case GAMMA_METHOD_LINUX_DRM: printf("Linux DRM\n"); break; + case GAMMA_METHOD_W32_GDI: printf("Windows GDI\n"); break; + case GAMMA_METHOD_QUARTZ_CORE_GRAPHICS: printf("Quartz using Core Graphics\n"); break; default: #if GAMMA_METHOD_COUNT != 6 # warning List of adjustment methods is out of date |