summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gmail.com>2020-11-29 17:15:15 +0000
committerEmmanuele Bassi <ebassi@gmail.com>2020-11-29 17:15:15 +0000
commit22c98d759ef833704bab916972469bddaa781e06 (patch)
treec7884c25ed1398eed7343e3711a94437db7ca8dd
parentbf6e1fb8fa84aeedf91875a799836f84b4044020 (diff)
parent2fd7d21fae6d9b8a3ae386e83d74c8ce76285ae8 (diff)
downloadgdk-pixbuf-22c98d759ef833704bab916972469bddaa781e06.tar.gz
Merge branch 'gif-invalid-background' into 'master'
gif: Fix GIF images without a Graphic Control Extension rendering colour 0 as the background. Closes #162 See merge request GNOME/gdk-pixbuf!91
-rw-r--r--gdk-pixbuf/io-gif.c1
-rw-r--r--tests/meson.build1
-rw-r--r--tests/pixbuf-gif.c20
3 files changed, 5 insertions, 17 deletions
diff --git a/gdk-pixbuf/io-gif.c b/gdk-pixbuf/io-gif.c
index 07fee59cf..57e72d88b 100644
--- a/gdk-pixbuf/io-gif.c
+++ b/gdk-pixbuf/io-gif.c
@@ -792,6 +792,7 @@ new_context (GdkPixbufModuleSizeFunc size_func,
context->animation = g_object_new (GDK_TYPE_PIXBUF_GIF_ANIM, NULL);
context->frame = NULL;
+ context->transparent_index = -1;
context->file = NULL;
context->state = GIF_START;
context->size_func = size_func;
diff --git a/tests/meson.build b/tests/meson.build
index d3453d3f9..c9cf25c6e 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -78,7 +78,6 @@ installed_tests = {
'pixbuf-threads': { 'suites': ['io'], },
'pixbuf-gif': {
'suites': ['io'],
- 'skip': not enabled_loaders.contains('gif'),
},
'pixbuf-icc': {
'suites': ['io'],
diff --git a/tests/pixbuf-gif.c b/tests/pixbuf-gif.c
index 04b337113..c5f11f48e 100644
--- a/tests/pixbuf-gif.c
+++ b/tests/pixbuf-gif.c
@@ -79,7 +79,7 @@ run_gif_test (gconstpointer data)
int i;
GError *error = NULL;
- if (!format_supported (filename))
+ if (!format_supported ("gif"))
{
g_test_skip ("GIF format not supported");
return;
@@ -129,7 +129,7 @@ run_gif_test (gconstpointer data)
{
const gchar *frame = frames[i];
GdkPixbuf *pixbuf;
- gint delay_time, expected_delay_time = 0;
+ gint delay_time, expected_delay_time = 100;
gchar *pixels_filename;
GFile *pixels_file;
GBytes *expected_pixels, *pixels;
@@ -147,18 +147,6 @@ run_gif_test (gconstpointer data)
expected_delay_time = g_key_file_get_integer (config_file, frame, "delay", &error) * 10;
g_assert_no_error (error);
- /* gdk-pixbuf uses 20ms minimum delay when no delay specified */
- if (expected_delay_time < 20)
- expected_delay_time = 20;
-
- /* gdk-pixbuf uses 100ms minimum when using Graphics Control Extension */
- if (strcmp (name, "transparent") == 0 ||
- strcmp (name, "invalid-transparent") == 0 ||
- strcmp (name, "disabled-transparent") == 0 ||
- strcmp (name, "animation-zero-delays") == 0)
- if (expected_delay_time < 100)
- expected_delay_time = 100;
-
g_assert_cmpint (delay_time, ==, expected_delay_time);
pixbuf = gdk_pixbuf_animation_iter_get_pixbuf (iter);
@@ -176,10 +164,10 @@ run_gif_test (gconstpointer data)
g_assert_cmpint (gdk_pixbuf_get_colorspace (pixbuf), ==, GDK_COLORSPACE_RGB);
g_assert_cmpint (gdk_pixbuf_get_n_channels (pixbuf), ==, 4);
- g_assert (gdk_pixbuf_get_has_alpha (pixbuf));
+ g_assert_true (gdk_pixbuf_get_has_alpha (pixbuf));
g_assert_cmpint (gdk_pixbuf_get_rowstride (pixbuf), ==, width * 4);
pixels = g_bytes_new_static (gdk_pixbuf_read_pixels (pixbuf), gdk_pixbuf_get_byte_length (pixbuf));
- g_assert (pixels_match (pixels, expected_pixels));
+ g_assert_true (pixels_match (pixels, expected_pixels));
g_clear_pointer (&pixels, g_bytes_unref);
g_clear_pointer (&expected_pixels, g_bytes_unref);
}