You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pixbuf_test.h 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef _PIXBUF_TEST_H
  2. #define _PIXBUF_TEST_H
  3. FILE_LICENCE ( GPL2_OR_LATER );
  4. #include <stdint.h>
  5. #include <ipxe/refcnt.h>
  6. #include <ipxe/image.h>
  7. #include <ipxe/test.h>
  8. /** A pixel buffer test */
  9. struct pixel_buffer_test {
  10. /** Image type */
  11. struct image_type *type;
  12. /** Source image */
  13. struct image *image;
  14. /** Pixel data */
  15. const uint32_t *data;
  16. /** Length of pixel data */
  17. size_t len;
  18. /** Width */
  19. unsigned int width;
  20. /** Height */
  21. unsigned int height;
  22. };
  23. /**
  24. * Define a pixel buffer test
  25. *
  26. * @v _name Test name
  27. * @v _type Test image file type
  28. * @v _file Test image file data
  29. * @v _width Expected pixel buffer width
  30. * @v _height Expected pixel buffer height
  31. * @v _data Expected pixel buffer data
  32. * @ret test Pixel buffer test
  33. */
  34. #define PIX( _name, _type, _file, _width, _height, _data ) \
  35. static const char _name ## __file[] = _file; \
  36. static const uint32_t _name ## __data[] = _data; \
  37. static struct image _name ## __image = { \
  38. .refcnt = REF_INIT ( ref_no_free ), \
  39. .name = #_name, \
  40. .data = ( userptr_t ) ( _name ## __file ), \
  41. .len = sizeof ( _name ## __file ), \
  42. }; \
  43. static struct pixel_buffer_test _name = { \
  44. .type = _type, \
  45. .image = & _name ## __image, \
  46. .data = _name ## __data, \
  47. .len = sizeof ( _name ## __data ), \
  48. .width = _width, \
  49. .height = _height, \
  50. };
  51. extern void pixbuf_okx ( struct pixel_buffer_test *test, const char *file,
  52. unsigned int line );
  53. /**
  54. * Report pixel buffer test result
  55. *
  56. * @v test Pixel buffer test
  57. */
  58. #define pixbuf_ok( test ) pixbuf_okx ( test, __FILE__, __LINE__ )
  59. #endif /* _PIXBUF_TEST_H */