diff --git a/test/blit.c b/test/blit.c index 26a140b..735f34b 100644 --- a/test/blit.c +++ b/test/blit.c @@ -43,8 +43,19 @@ int main(int argc, char *argv[]) cucul_canvas_t *cv, *sprite; caca_display_t *dp; - cv = cucul_create_canvas(0, 0); + cv = cucul_create_canvas(32, 16); + if(cv == NULL) + { + printf("Failed to create canvas\n"); + return 1; + } + dp = caca_create_display(cv); + if(dp == NULL) + { + printf("Failed to create display\n"); + return 1; + } sprite = cucul_create_canvas(0, 0); cucul_set_color_ansi(sprite, CUCUL_LIGHTRED, CUCUL_BLACK); diff --git a/test/colors.c b/test/colors.c index f97f5ac..94c988f 100644 --- a/test/colors.c +++ b/test/colors.c @@ -28,13 +28,19 @@ int main(int argc, char **argv) caca_display_t *dp; int i, j; - cv = cucul_create_canvas(0, 0); - if(!cv) + cv = cucul_create_canvas(32, 16); + if(cv == NULL) + { + printf("Failed to create canvas\n"); return 1; + } dp = caca_create_display(cv); - if(!dp) + if(dp == NULL) + { + printf("Failed to create display\n"); return 1; + } cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); cucul_clear_canvas(cv); diff --git a/test/cucul.c b/test/cucul.c index ff217bb..a2ad770 100644 --- a/test/cucul.c +++ b/test/cucul.c @@ -44,6 +44,12 @@ int main(int argc, char *argv[]) fprintf(stderr, "testing cucul_set_frame_name()\n"); cv = cucul_create_canvas(1, 1); + if(cv == NULL) + { + printf("Failed to create canvas\n"); + return 1; + } + for(i = 0; i < ITER; i++) { cucul_create_frame(cv, 0); diff --git a/test/demo.c b/test/demo.c index 019482f..c369b2c 100644 --- a/test/demo.c +++ b/test/demo.c @@ -48,12 +48,19 @@ int main(int argc, char **argv) void (*demo)(void) = NULL; int quit = 0; - cv = cucul_create_canvas(0, 0); - if(!cv) + cv = cucul_create_canvas(32, 16); + if(cv == NULL) + { + printf("Failed to create canvas\n"); return 1; + } + dp = caca_create_display(cv); - if(!dp) + if(dp == NULL) + { + printf("Failed to create display\n"); return 1; + } caca_set_display_time(dp, 40000); diff --git a/test/dithering.c b/test/dithering.c index d99ff92..ab149c8 100644 --- a/test/dithering.c +++ b/test/dithering.c @@ -41,8 +41,21 @@ int main(int argc, char *argv[]) int neara, dista, nearb, distb, dist; int x, y; - cv = cucul_create_canvas(0, 0); + cv = cucul_create_canvas(32, 16); + if(cv == NULL) + { + printf("Failed to create canvas\n"); + return 1; + } + dp = caca_create_display(cv); + if(dp == NULL) + { + printf("Failed to create display\n"); + return 1; + } + + for(x = 0; x < 100; x++) for(y = 0; y < 100; y++) diff --git a/test/event.c b/test/event.c index 3c6a20c..af87631 100644 --- a/test/event.c +++ b/test/event.c @@ -33,12 +33,19 @@ int main(int argc, char **argv) caca_event_t *events; int i, h, quit; - cv = cucul_create_canvas(0, 0); - if(!cv) + cv = cucul_create_canvas(32, 16); + if(cv == NULL) + { + printf("Failed to create canvas\n"); return 1; + } + dp = caca_create_display(cv); - if(!dp) + if(dp == NULL) + { + printf("Failed to create display\n"); return 1; + } h = cucul_get_canvas_height(cv) - 1; diff --git a/test/font.c b/test/font.c index a9f58e3..d39c0c8 100644 --- a/test/font.c +++ b/test/font.c @@ -44,6 +44,12 @@ int main(int argc, char *argv[]) /* Create a canvas */ cv = cucul_create_canvas(8, 2); + if(cv == NULL) + { + printf("Can't create canvas\n"); + return -1; + } + /* Draw stuff on our canvas */ cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLACK); diff --git a/test/frames.c b/test/frames.c index 9a45695..6167bd7 100644 --- a/test/frames.c +++ b/test/frames.c @@ -33,6 +33,12 @@ int main(int argc, char *argv[]) /* Create a canvas with 200 frames */ cv = cucul_create_canvas(0, 0); + if(cv == NULL) + { + printf("Can't create canvas\n"); + return -1; + } + for(frame = 1; frame < 200; frame++) cucul_create_frame(cv, frame); diff --git a/test/fullwidth.c b/test/fullwidth.c index 0be77c9..e6b64f2 100644 --- a/test/fullwidth.c +++ b/test/fullwidth.c @@ -35,7 +35,17 @@ int main(int argc, char *argv[]) unsigned int i; cv = cucul_create_canvas(0, 0); + if(cv == NULL) + { + printf("Can't created canvas\n"); + return -1; + } dp = caca_create_display(cv); + if(dp == NULL) + { + printf("Can't create display\n"); + return -1; + } caca = cucul_create_canvas(6, 10); line = cucul_create_canvas(2, 1); diff --git a/test/gamma.c b/test/gamma.c index 16e87ca..826be34 100644 --- a/test/gamma.c +++ b/test/gamma.c @@ -38,7 +38,17 @@ int main(int argc, char *argv[]) int x; cv = cucul_create_canvas(0, 0); + if(cv == NULL) + { + printf("Can't created canvas\n"); + return -1; + } dp = caca_create_display(cv); + if(dp == NULL) + { + printf("Can't create display\n"); + return -1; + } cw = cucul_create_canvas(cucul_get_canvas_width(cv), cucul_get_canvas_height(cv)); mask = cucul_create_canvas(cucul_get_canvas_width(cv), cucul_get_canvas_height(cv)); diff --git a/test/hsv.c b/test/hsv.c index 318e97b..74263d9 100644 --- a/test/hsv.c +++ b/test/hsv.c @@ -36,7 +36,17 @@ int main(int argc, char *argv[]) int x, y; cv = cucul_create_canvas(0, 0); + if(cv == NULL) + { + printf("Can't created canvas\n"); + return -1; + } dp = caca_create_display(cv); + if(dp == NULL) + { + printf("Can't create display\n"); + return -1; + } for(y = 0; y < 256; y++) for(x = 0; x < 256; x++) diff --git a/test/import.c b/test/import.c index 5fca36f..83bcf37 100644 --- a/test/import.c +++ b/test/import.c @@ -41,6 +41,12 @@ int main(int argc, char *argv[]) } cv = cucul_create_canvas(0, 0); + if(cv == NULL) + { + printf("Can't create canvas\n"); + return -1; + } + if(cucul_import_file(cv, argv[1], argc >= 3 ? argv[2] : "") < 0) { fprintf(stderr, "%s: could not open `%s'.\n", argv[0], argv[1]); @@ -49,6 +55,11 @@ int main(int argc, char *argv[]) } dp = caca_create_display(cv); + if(dp == NULL) + { + printf("Can't create display\n"); + return -1; + } caca_refresh_display(dp); diff --git a/test/input.c b/test/input.c index 1e22170..65803e1 100644 --- a/test/input.c +++ b/test/input.c @@ -42,7 +42,17 @@ int main(int argc, char *argv[]) unsigned int i, e = 0, running = 1; cv = cucul_create_canvas(0, 0); + if(cv == NULL) + { + printf("Can't created canvas\n"); + return -1; + } dp = caca_create_display(cv); + if(dp == NULL) + { + printf("Can't create display\n"); + return -1; + } cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); cucul_put_str(cv, 1, 1, "Text entries - press tab to cycle"); diff --git a/test/swallow.c b/test/swallow.c index 5284758..7f877d3 100644 --- a/test/swallow.c +++ b/test/swallow.c @@ -42,8 +42,17 @@ int main(int argc, char **argv) cv = cucul_create_canvas(0, 0); app = cucul_create_canvas(0, 0); dp = caca_create_display(cv); - if(!dp) - return 1; + + if(cv == NULL || app == NULL ) + { + printf("Can't created canvas\n"); + return -1; + } + if(dp == NULL) + { + printf("Can't create display\n"); + return -1; + } w = (cucul_get_canvas_width(cv) - 4) / 2; h = (cucul_get_canvas_height(cv) - 6) / 2; diff --git a/test/text.c b/test/text.c index a11a02d..208b131 100644 --- a/test/text.c +++ b/test/text.c @@ -44,6 +44,12 @@ int main(int argc, char *argv[]) cv = cucul_create_canvas(cucul_get_canvas_width(pig) * 2, cucul_get_canvas_height(pig) * 2); + if(cv == NULL || pig == NULL) + { + printf("Can't created canvas\n"); + return -1; + } + cucul_blit(cv, 0, 0, pig, NULL); cucul_flip(pig); cucul_blit(cv, cucul_get_canvas_width(pig), 0, pig, NULL); diff --git a/test/transform.c b/test/transform.c index 4ed94aa..e941d0d 100644 --- a/test/transform.c +++ b/test/transform.c @@ -46,7 +46,17 @@ int main(int argc, char *argv[]) caca_display_t *dp; cv = cucul_create_canvas(0, 0); + if(cv == NULL) + { + printf("Can't created canvas\n"); + return -1; + } dp = caca_create_display(cv); + if(dp == NULL) + { + printf("Can't create display\n"); + return -1; + } image = cucul_create_canvas(70, 6); tmp = cucul_create_canvas(70, 6); diff --git a/test/unicode.c b/test/unicode.c index db2b487..5d0140e 100644 --- a/test/unicode.c +++ b/test/unicode.c @@ -31,8 +31,17 @@ int main(int argc, char *argv[]) caca_display_t *dp; cv = cucul_create_canvas(0, 0); + if(cv == NULL) + { + printf("Can't created canvas\n"); + return -1; + } dp = caca_create_display(cv); - + if(dp == NULL) + { + printf("Can't create display\n"); + return -1; + } cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); cucul_put_str(cv, 1, 1, "Basic Unicode support");