summaryrefslogtreecommitdiffstats
path: root/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/tests-check.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/tests-check.patch')
-rw-r--r--meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/tests-check.patch465
1 files changed, 465 insertions, 0 deletions
diff --git a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/tests-check.patch b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/tests-check.patch
new file mode 100644
index 0000000..31f3368
--- /dev/null
+++ b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/tests-check.patch
@@ -0,0 +1,465 @@
1Upstream-Status: Backport
2Signed-off-by: Ross Burton <ross.burton@intel.com>
3
4From 9fa240c1ad5a815d63d8aa9126954152c2607f2e Mon Sep 17 00:00:00 2001
5From: Matthias Clasen <mclasen@redhat.com>
6Date: Sat, 25 Jan 2014 21:29:34 +0000
7Subject: Make testsuite robust against disabled formats
8
9Skip tests if their file format is not supported by the
10available loaders.
11
12https://bugzilla.gnome.org/show_bug.cgi?id=722651
13---
14diff --git a/tests/Makefile.am b/tests/Makefile.am
15index de3442e..80840c2 100644
16--- a/tests/Makefile.am
17+++ b/tests/Makefile.am
18@@ -42,17 +42,57 @@ dist_installed_test_data = \
19 icc-profile.png \
20 $(wildcard $(srcdir)/test-images/*)
21
22+pixbuf_icc_SOURCES = \
23+ pixbuf-icc.c \
24+ test-common.c \
25+ test-common.h \
26+ $(NULL)
27+
28+pixbuf_scale_SOURCES = \
29+ pixbuf-scale.c \
30+ test-common.c \
31+ test-common.h \
32+ $(NULL)
33+
34+pixbuf_stream_SOURCES = \
35+ pixbuf-stream.c \
36+ test-common.c \
37+ test-common.h \
38+ $(NULL)
39+
40+pixbuf_threads_SOURCES = \
41+ pixbuf-threads.c \
42+ test-common.c \
43+ test-common.h \
44+ $(NULL)
45+
46+pixbuf_icon_serialize_SOURCES = \
47+ pixbuf-icon-serialize.c \
48+ test-common.c \
49+ test-common.h \
50+ $(NULL)
51+
52+pixbuf_save_SOURCES = \
53+ pixbuf-save.c \
54+ test-common.c \
55+ test-common.h \
56+ $(NULL)
57+
58 pixbuf_resource_SOURCES = \
59 pixbuf-resource.c \
60+ test-common.c \
61+ test-common.h \
62 resources.h \
63- resources.c
64+ resources.c \
65+ $(NULL)
66
67 BUILT_SOURCES += resources.h resources.c
68 DISTCLEANFILES += \
69 resources.h resources.c \
70 pixbuf-save-options \
71 pixbuf-randomly-modified-image \
72- pixbuf-save-roundtrip
73+ pixbuf-save-roundtrip \
74+ $(NULL)
75
76 EXTRA_DIST += resources.gresource.xml
77 TESTS_ENVIRONMENT += GDK_PIXBUF_MODULE_FILE=$(top_builddir)/gdk-pixbuf/loaders.cache
78diff --git a/tests/pixbuf-icc.c b/tests/pixbuf-icc.c
79index 9cb9c90..3b95b09 100644
80--- a/tests/pixbuf-icc.c
81+++ b/tests/pixbuf-icc.c
82@@ -22,6 +22,7 @@
83
84 #include "config.h"
85 #include "gdk-pixbuf/gdk-pixbuf.h"
86+#include "test-common.h"
87
88 static void
89 test_incremental (gconstpointer data)
90@@ -34,7 +35,12 @@ test_incremental (gconstpointer data)
91 gchar *contents;
92 gsize size;
93
94-
95+ if (!format_supported (filename))
96+ {
97+ g_test_skip ("format not supported");
98+ return;
99+ }
100+
101 g_file_get_contents (g_test_get_filename (G_TEST_DIST, filename, NULL), &contents, &size, &error);
102 g_assert_no_error (error);
103
104@@ -62,6 +68,12 @@ test_nonincremental (gconstpointer data)
105 GdkPixbuf *pixbuf;
106 const gchar *profile;
107
108+ if (!format_supported (filename))
109+ {
110+ g_test_skip ("format not supported");
111+ return;
112+ }
113+
114 pixbuf = gdk_pixbuf_new_from_file (g_test_get_filename (G_TEST_DIST, filename, NULL), &error);
115 g_assert_no_error (error);
116
117diff --git a/tests/pixbuf-icon-serialize.c b/tests/pixbuf-icon-serialize.c
118index 20bf6e1..880c654 100644
119--- a/tests/pixbuf-icon-serialize.c
120+++ b/tests/pixbuf-icon-serialize.c
121@@ -1,5 +1,6 @@
122 #include "config.h"
123 #include "gdk-pixbuf/gdk-pixbuf.h"
124+#include "test-common.h"
125 #include <string.h>
126 #include <glib.h>
127
128@@ -13,6 +14,12 @@ test_serialize (void)
129 GIcon *icon;
130 GInputStream *stream;
131
132+ if (!format_supported ("png"))
133+ {
134+ g_test_skip ("format not supported");
135+ return;
136+ }
137+
138 pixbuf = gdk_pixbuf_new_from_file (g_test_get_filename (G_TEST_DIST, "test-image.png", NULL), &error);
139 g_assert_no_error (error);
140 g_assert (pixbuf != NULL);
141diff --git a/tests/pixbuf-resource.c b/tests/pixbuf-resource.c
142index a747bca..aa0bed8 100644
143--- a/tests/pixbuf-resource.c
144+++ b/tests/pixbuf-resource.c
145@@ -22,6 +22,7 @@
146
147 #include "config.h"
148 #include "gdk-pixbuf/gdk-pixbuf.h"
149+#include "test-common.h"
150 #include <string.h>
151
152 #define compare_option(p1, p2, key) \
153@@ -77,6 +78,12 @@ test_resource (void)
154 GError *error = NULL;
155 GdkPixbuf *pixbuf, *ref;
156
157+ if (!format_supported ("png"))
158+ {
159+ g_test_skip ("format not supported");
160+ return;
161+ }
162+
163 path = g_test_get_filename (G_TEST_DIST, "icc-profile.png", NULL);
164 ref = gdk_pixbuf_new_from_file (path, &error);
165 g_assert_no_error (error);
166@@ -111,6 +118,12 @@ test_resource_at_scale (void)
167 GError *error = NULL;
168 GdkPixbuf *pixbuf, *ref;
169
170+ if (!format_supported ("png"))
171+ {
172+ g_test_skip ("format not supported");
173+ return;
174+ }
175+
176 path = g_test_get_filename (G_TEST_DIST, "icc-profile.png", NULL);
177 ref = gdk_pixbuf_new_from_file_at_scale (path, 40, 10, FALSE, &error);
178 g_assert_no_error (error);
179diff --git a/tests/pixbuf-save.c b/tests/pixbuf-save.c
180index f7df29b..78ab288 100644
181--- a/tests/pixbuf-save.c
182+++ b/tests/pixbuf-save.c
183@@ -21,6 +21,7 @@
184 */
185
186 #include "gdk-pixbuf/gdk-pixbuf.h"
187+#include "test-common.h"
188 #include <string.h>
189
190 #define compare_option(p1, p2, key) \
191@@ -76,6 +77,12 @@ test_save_roundtrip (void)
192 GdkPixbuf *ref;
193 GdkPixbuf *pixbuf;
194
195+ if (!format_supported ("png"))
196+ {
197+ g_test_skip ("format not supported");
198+ return;
199+ }
200+
201 ref = gdk_pixbuf_new_from_file (g_test_get_filename (G_TEST_DIST, "test-image.png", NULL), &error);
202 g_assert_no_error (error);
203
204@@ -98,6 +105,12 @@ test_save_options (void)
205 GdkPixbuf *pixbuf;
206 GError *error = NULL;
207
208+ if (!format_supported ("png"))
209+ {
210+ g_test_skip ("format not supported");
211+ return;
212+ }
213+
214 ref = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 10, 10);
215 gdk_pixbuf_fill (ref, 0xff00ff00);
216
217diff --git a/tests/pixbuf-scale.c b/tests/pixbuf-scale.c
218index 4fd9fd5..d57e56a 100644
219--- a/tests/pixbuf-scale.c
220+++ b/tests/pixbuf-scale.c
221@@ -22,6 +22,7 @@
222
223 #include "config.h"
224 #include "gdk-pixbuf/gdk-pixbuf.h"
225+#include "test-common.h"
226
227 static void
228 test_scale (gconstpointer data)
229@@ -33,6 +34,12 @@ test_scale (gconstpointer data)
230 GdkPixbuf *pixbuf;
231 gint width, height;
232
233+ if (!format_supported (filename))
234+ {
235+ g_test_skip ("format not supported");
236+ return;
237+ }
238+
239 path = g_test_get_filename (G_TEST_DIST, filename, NULL);
240 ref = gdk_pixbuf_new_from_file (path, &error);
241 g_assert_no_error (error);
242diff --git a/tests/pixbuf-stream.c b/tests/pixbuf-stream.c
243index 0c2cebe..d66ce3e 100644
244--- a/tests/pixbuf-stream.c
245+++ b/tests/pixbuf-stream.c
246@@ -22,6 +22,7 @@
247
248 #include "config.h"
249 #include "gdk-pixbuf/gdk-pixbuf.h"
250+#include "test-common.h"
251 #include <string.h>
252
253 #define compare_option(p1, p2, key) \
254@@ -71,6 +72,12 @@ test_stream (gconstpointer data)
255 GFile *file;
256 GInputStream *stream;
257
258+ if (!format_supported (filename))
259+ {
260+ g_test_skip ("format not supported");
261+ return;
262+ }
263+
264 path = g_test_get_filename (G_TEST_DIST, filename, NULL);
265 ref = gdk_pixbuf_new_from_file (path, &error);
266 g_assert_no_error (error);
267@@ -116,6 +123,12 @@ test_stream_async (gconstpointer data)
268 gsize size;
269 GInputStream *stream;
270
271+ if (!format_supported (filename))
272+ {
273+ g_test_skip ("format not supported");
274+ return;
275+ }
276+
277 path = g_test_get_filename (G_TEST_DIST, filename, NULL);
278 ref = gdk_pixbuf_new_from_file (path, &error);
279 g_assert_no_error (error);
280@@ -138,6 +151,12 @@ test_stream_at_scale (gconstpointer data)
281 GFile *file;
282 GInputStream *stream;
283
284+ if (!format_supported (filename))
285+ {
286+ g_test_skip ("format not supported");
287+ return;
288+ }
289+
290 path = g_test_get_filename (G_TEST_DIST, filename, NULL);
291 ref = gdk_pixbuf_new_from_file_at_scale (path, 20, 30, TRUE, &error);
292 g_assert_no_error (error);
293@@ -167,6 +186,12 @@ test_stream_at_scale_async (gconstpointer data)
294 gsize size;
295 GInputStream *stream;
296
297+ if (!format_supported (filename))
298+ {
299+ g_test_skip ("format not supported");
300+ return;
301+ }
302+
303 path = g_test_get_filename (G_TEST_DIST, filename, NULL);
304 ref = gdk_pixbuf_new_from_file_at_scale (path, 40, 10, FALSE, &error);
305 g_assert_no_error (error);
306diff --git a/tests/pixbuf-threads.c b/tests/pixbuf-threads.c
307index 5eeb9dd..f2694fd 100644
308--- a/tests/pixbuf-threads.c
309+++ b/tests/pixbuf-threads.c
310@@ -18,7 +18,9 @@
311 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
312 */
313
314+#include "config.h"
315 #include "gdk-pixbuf/gdk-pixbuf.h"
316+#include "test-common.h"
317
318 static void
319 load_image (gpointer data,
320@@ -71,15 +73,24 @@ test_threads (void)
321
322 for (i = 0; i < iterations; i++)
323 {
324- g_thread_pool_push (pool, "valid_jpeg_test", NULL);
325- g_thread_pool_push (pool, "valid_png_test", NULL);
326- g_thread_pool_push (pool, "valid_gif_test", NULL);
327- g_thread_pool_push (pool, "valid_bmp_test", NULL);
328- g_thread_pool_push (pool, "valid_jpeg_progressive_test", NULL);
329- g_thread_pool_push (pool, "valid_xpm_test", NULL);
330- g_thread_pool_push (pool, "valid_ras_test", NULL);
331- g_thread_pool_push (pool, "valid_tga_test", NULL);
332- g_thread_pool_push (pool, "valid_tiff1_test", NULL);
333+ if (format_supported ("jpeg"))
334+ g_thread_pool_push (pool, "valid_jpeg_test", NULL);
335+ if (format_supported ("png"))
336+ g_thread_pool_push (pool, "valid_png_test", NULL);
337+ if (format_supported ("gif"))
338+ g_thread_pool_push (pool, "valid_gif_test", NULL);
339+ if (format_supported ("bmp"))
340+ g_thread_pool_push (pool, "valid_bmp_test", NULL);
341+ if (format_supported ("jpeg"))
342+ g_thread_pool_push (pool, "valid_jpeg_progressive_test", NULL);
343+ if (format_supported ("xpm"))
344+ g_thread_pool_push (pool, "valid_xpm_test", NULL);
345+ if (format_supported ("ras"))
346+ g_thread_pool_push (pool, "valid_ras_test", NULL);
347+ if (format_supported ("tga"))
348+ g_thread_pool_push (pool, "valid_tga_test", NULL);
349+ if (format_supported ("tiff"))
350+ g_thread_pool_push (pool, "valid_tiff1_test", NULL);
351 }
352
353 g_thread_pool_free (pool, FALSE, TRUE);
354diff --git a/tests/test-common.c b/tests/test-common.c
355new file mode 100644
356index 0000000..c7673e3
357--- /dev/null
358+++ b/tests/test-common.c
359@@ -0,0 +1,65 @@
360+/* -*- Mode: C; c-basic-offset: 2; -*- */
361+/* GdkPixbuf library - test loaders
362+ *
363+ * Copyright (C) 2014 Red Hat, Inc.
364+ *
365+ * This program is free software; you can redistribute it and/or modify
366+ * it under the terms of the GNU General Public License as published by
367+ * the Free Software Foundation; either version 2 of the License, or
368+ * (at your option) any later version.
369+ *
370+ * This program is distributed in the hope that it will be useful,
371+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
372+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
373+ * GNU General Public License for more details.
374+ *
375+ * You should have received a copy of the GNU General Public License
376+ * along with this program; if not, write to the Free Software
377+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
378+ *
379+ * Author: Matthias Clasen
380+ */
381+
382+#include "config.h"
383+#include "test-common.h"
384+#include "gdk-pixbuf/gdk-pixbuf.h"
385+
386+#include <string.h>
387+
388+gboolean
389+format_supported (const gchar *filename)
390+{
391+ const gchar *name = NULL;
392+ GSList *formats, *l;
393+ gboolean retval;
394+ const gchar *names[] = { "png", "jpeg", "bmp", "gif", "ras",
395+ "tga", "xpm", "xbm" };
396+ gint i;
397+
398+ for (i = 0; i < G_N_ELEMENTS (names); i++)
399+ {
400+ if (strstr (filename, names[i]))
401+ {
402+ name = names[i];
403+ break;
404+ }
405+ }
406+ if (name == NULL)
407+ return FALSE;
408+
409+ retval = FALSE;
410+ formats = gdk_pixbuf_get_formats ();
411+ for (l = formats; l; l = l->next)
412+ {
413+ GdkPixbufFormat *format = l->data;
414+
415+ if (g_str_equal (gdk_pixbuf_format_get_name (format), name))
416+ {
417+ retval = TRUE;
418+ break;
419+ }
420+ }
421+ g_slist_free (formats);
422+
423+ return retval;
424+}
425diff --git a/tests/test-common.h b/tests/test-common.h
426new file mode 100644
427index 0000000..32ff35a
428--- /dev/null
429+++ b/tests/test-common.h
430@@ -0,0 +1,33 @@
431+/* -*- Mode: C; c-basic-offset: 2; -*- */
432+/* GdkPixbuf library - test loaders
433+ *
434+ * Copyright (C) 2014 Red Hat, Inc.
435+ *
436+ * This program is free software; you can redistribute it and/or modify
437+ * it under the terms of the GNU General Public License as published by
438+ * the Free Software Foundation; either version 2 of the License, or
439+ * (at your option) any later version.
440+ *
441+ * This program is distributed in the hope that it will be useful,
442+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
443+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
444+ * GNU General Public License for more details.
445+ *
446+ * You should have received a copy of the GNU General Public License
447+ * along with this program; if not, write to the Free Software
448+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
449+ *
450+ * Author: Matthias Clasen
451+ */
452+
453+#ifndef __TEST_COMMON_H__
454+
455+#include <glib.h>
456+
457+G_BEGIN_DECLS
458+
459+gboolean format_supported (const gchar *filename);
460+
461+G_END_DECLS
462+
463+#endif /* __TEST_COMMON_H__ */
464--
465cgit v0.9.2 \ No newline at end of file