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