Rename GP_Context -> GP_Pixmap
[gfxprim.git] / tests / loaders / PNM.c
blob309570998252c54b5b0ff50e5684e61bc005ac96
1 /*****************************************************************************
2 * This file is part of gfxprim library. *
3 * *
4 * Gfxprim is free software; you can redistribute it and/or *
5 * modify it under the terms of the GNU Lesser General Public *
6 * License as published by the Free Software Foundation; either *
7 * version 2.1 of the License, or (at your option) any later version. *
8 * *
9 * Gfxprim is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
12 * Lesser General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU Lesser General Public *
15 * License along with gfxprim; if not, write to the Free Software *
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
17 * Boston, MA 02110-1301 USA *
18 * *
19 * Copyright (C) 2009-2014 Cyril Hrubis <metan@ucw.cz> *
20 * *
21 *****************************************************************************/
23 #include <string.h>
24 #include <errno.h>
25 #include <sys/stat.h>
27 #include <core/GP_Pixmap.h>
28 #include <core/GP_GetPutPixel.h>
29 #include <loaders/GP_Loaders.h>
31 #include "tst_test.h"
33 #define READ GP_ReadPNM
34 #include "Loader.h"
35 #include "PBM.h"
36 #include "PGM.h"
37 #include "PPM.h"
39 const struct tst_suite tst_suite = {
40 .suite_name = "PNM",
41 .tests = {
42 /* PBM tests */
43 {.name = "PBM Read 1x1 (black)",
44 .tst_fn = test_read,
45 .data = &PBM_ascii_1x1_black,
46 .flags = TST_CHECK_MALLOC},
48 {.name = "PBM Read 1x1 (white)",
49 .tst_fn = test_read,
50 .data = &PBM_ascii_1x1_white,
51 .flags = TST_CHECK_MALLOC},
53 {.name = "PBM Read 1x1 (black) Raw",
54 .tst_fn = test_read,
55 .data = &PBM_bin_1x1_black,
56 .flags = TST_CHECK_MALLOC},
58 {.name = "PBM Read 1x1 (white) Raw",
59 .tst_fn = test_read,
60 .data = &PBM_bin_1x1_white,
61 .flags = TST_CHECK_MALLOC},
63 /* PGM tests */
64 {.name = "PGM Read 1x1 1bpp (black)",
65 .tst_fn = test_read,
66 .data = &PGM_ascii_1x1_1bpp_black,
67 .flags = TST_CHECK_MALLOC},
69 {.name = "PGM Read 1x1 2bpp (black)",
70 .tst_fn = test_read,
71 .data = &PGM_ascii_1x1_2bpp_black,
72 .flags = TST_CHECK_MALLOC},
74 {.name = "PGM Read 1x1 4bpp (black)",
75 .tst_fn = test_read,
76 .data = &PGM_ascii_1x1_4bpp_black,
77 .flags = TST_CHECK_MALLOC},
79 {.name = "PGM Read 1x1 8bpp (black)",
80 .tst_fn = test_read,
81 .data = &PGM_ascii_1x1_8bpp_black,
82 .flags = TST_CHECK_MALLOC},
84 {.name = "PGM Read 1x1 1bpp (white)",
85 .tst_fn = test_read,
86 .data = &PGM_ascii_1x1_1bpp_white,
87 .flags = TST_CHECK_MALLOC},
89 {.name = "PGM Read 1x1 2bpp (white)",
90 .tst_fn = test_read,
91 .data = &PGM_ascii_1x1_2bpp_white,
92 .flags = TST_CHECK_MALLOC},
94 {.name = "PGM Read 1x1 4bpp (white)",
95 .tst_fn = test_read,
96 .data = &PGM_ascii_1x1_4bpp_white,
97 .flags = TST_CHECK_MALLOC},
99 {.name = "PGM Read 1x1 8bpp (white)",
100 .tst_fn = test_read,
101 .data = &PGM_ascii_1x1_8bpp_white,
102 .flags = TST_CHECK_MALLOC},
104 {.name = "PGM Read 1x1 1bpp (white) Raw",
105 .tst_fn = test_read,
106 .data = &PGM_bin_1x1_1bpp_white,
107 .flags = TST_CHECK_MALLOC},
109 {.name = "PGM Read 1x1 2bpp (white) Raw",
110 .tst_fn = test_read,
111 .data = &PGM_bin_1x1_2bpp_white,
112 .flags = TST_CHECK_MALLOC},
114 {.name = "PGM Read 1x1 4bpp (white) Raw",
115 .tst_fn = test_read,
116 .data = &PGM_bin_1x1_4bpp_white,
117 .flags = TST_CHECK_MALLOC},
119 {.name = "PGM Read 1x1 8bpp (white) Raw",
120 .tst_fn = test_read,
121 .data = &PGM_bin_1x1_8bpp_white,
122 .flags = TST_CHECK_MALLOC},
124 /* PPM tests */
125 {.name = "PPM Read 1x1 4bpp (black)",
126 .tst_fn = test_read,
127 .data = &PPM_ascii_1x1_4bpp_black,
128 .flags = TST_CHECK_MALLOC},
130 {.name = "PPM Read 1x1 8bpp (black)",
131 .tst_fn = test_read,
132 .data = &PPM_ascii_1x1_8bpp_black,
133 .flags = TST_CHECK_MALLOC},
135 {.name = "PPM Read 1x1 8bpp (white)",
136 .tst_fn = test_read,
137 .data = &PPM_ascii_1x1_8bpp_white,
138 .flags = TST_CHECK_MALLOC},
140 {.name = "PPM Read 1x1 8bpp (white) Raw",
141 .tst_fn = test_read,
142 .data = &PPM_bin_1x1_8bpp_white,
143 .flags = TST_CHECK_MALLOC},
145 {.name = NULL},