iPXE
pixbuf_test.h
Go to the documentation of this file.
1#ifndef _PIXBUF_TEST_H
2#define _PIXBUF_TEST_H
3
4FILE_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 */
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 .flags = ( IMAGE_STATIC | IMAGE_STATIC_NAME ), \
45 .data = _name ## __file, \
46 .len = sizeof ( _name ## __file ), \
47 }; \
48 static struct pixel_buffer_test _name = { \
49 .type = _type, \
50 .image = & _name ## __image, \
51 .data = _name ## __data, \
52 .len = sizeof ( _name ## __data ), \
53 .width = _width, \
54 .height = _height, \
55 };
56
57extern void pixbuf_okx ( struct pixel_buffer_test *test, const char *file,
58 unsigned int line );
59
60/**
61 * Report pixel buffer test result
62 *
63 * @v test Pixel buffer test
64 */
65#define pixbuf_ok( test ) pixbuf_okx ( test, __FILE__, __LINE__ )
66
67#endif /* _PIXBUF_TEST_H */
unsigned int uint32_t
Definition stdint.h:12
static int test
Definition epic100.c:73
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
Executable images.
void pixbuf_okx(struct pixel_buffer_test *test, const char *file, unsigned int line)
Report pixel buffer test result.
Definition pixbuf_test.c:49
Reference counting.
An executable image type.
Definition image.h:95
A pixel buffer test.
Definition pixbuf_test.h:12
struct image * image
Source image.
Definition pixbuf_test.h:16
unsigned int width
Width.
Definition pixbuf_test.h:22
const uint32_t * data
Pixel data.
Definition pixbuf_test.h:18
unsigned int height
Height.
Definition pixbuf_test.h:24
size_t len
Length of pixel data.
Definition pixbuf_test.h:20
struct image_type * type
Image type.
Definition pixbuf_test.h:14
Self-test infrastructure.