Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 
 

67 Zeilen
1.6 KiB

  1. /*
  2. * all full libcaca API test
  3. * Copyright (c) 2006-2010 Sam Hocevar <sam@hocevar.net>
  4. * All Rights Reserved
  5. *
  6. * This program is free software. It comes without any warranty, to
  7. * the extent permitted by applicable law. You can redistribute it
  8. * and/or modify it under the terms of the Do What The Fuck You Want
  9. * To Public License, Version 2, as published by Sam Hocevar. See
  10. * http://sam.zoy.org/wtfpl/COPYING for more details.
  11. */
  12. #include "config.h"
  13. #if !defined(__KERNEL__)
  14. # include <stdio.h>
  15. # include <string.h>
  16. #endif
  17. #include "caca.h"
  18. #define ITER 128
  19. int main(int argc, char *argv[])
  20. {
  21. caca_canvas_t *cv;
  22. unsigned int i, j, w, h;
  23. fprintf(stderr, "testing caca_create_canvas()\n");
  24. for(i = 0; i < ITER; i++)
  25. {
  26. w = caca_rand(1, 1000);
  27. h = caca_rand(1, 1000);
  28. cv = caca_create_canvas(w, h);
  29. caca_put_char(cv, w - 1, h - 1, 'x');
  30. if(caca_get_char(cv, w - 1, h - 1) != 'x')
  31. fprintf(stderr, " failed (%ux%u)\n", w, h);
  32. caca_free_canvas(cv);
  33. }
  34. fprintf(stderr, "testing caca_set_frame_name()\n");
  35. cv = caca_create_canvas(1, 1);
  36. if(cv == NULL)
  37. {
  38. printf("Failed to create canvas\n");
  39. return 1;
  40. }
  41. for(i = 0; i < ITER; i++)
  42. {
  43. caca_create_frame(cv, 0);
  44. for(j = 0; j < ITER; j++)
  45. {
  46. char buf[BUFSIZ];
  47. w = caca_rand(1, 1000);
  48. memset(buf, 'x', w);
  49. buf[w] = '\0';
  50. caca_set_frame_name(cv, buf);
  51. }
  52. }
  53. caca_free_canvas(cv);
  54. fprintf(stderr, "all tests passed\n");
  55. return 0;
  56. }