[gdk-pixbuf] tests: Add tests for new options helpers
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdk-pixbuf] tests: Add tests for new options helpers
- Date: Tue, 2 Aug 2016 18:51:31 +0000 (UTC)
commit be62101cf5f5ba8e919ceae9482cfeca190097d2
Author: Bastien Nocera <hadess hadess net>
Date: Sat Jun 25 21:27:54 2016 +0200
tests: Add tests for new options helpers
Exercising copy_options() and remove_option().
https://bugzilla.gnome.org/show_bug.cgi?id=768043
tests/pixbuf-save.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/tests/pixbuf-save.c b/tests/pixbuf-save.c
index 0191417..6c018f7 100644
--- a/tests/pixbuf-save.c
+++ b/tests/pixbuf-save.c
@@ -111,7 +111,7 @@ static void
test_save_options (void)
{
GdkPixbuf *ref;
- GdkPixbuf *pixbuf;
+ GdkPixbuf *pixbuf, *pixbuf2;
GError *error = NULL;
if (!format_supported ("png"))
@@ -141,6 +141,20 @@ test_save_options (void)
g_assert_cmpstr (gdk_pixbuf_get_option (pixbuf, "tEXt::3"), ==, "αβγδ");
#endif
+ pixbuf2 = gdk_pixbuf_copy (pixbuf);
+ g_assert_null (gdk_pixbuf_get_option (pixbuf2, "tEXt::option1"));
+ gdk_pixbuf_copy_options (pixbuf, pixbuf2);
+ g_assert_cmpstr (gdk_pixbuf_get_option (pixbuf2, "tEXt::option1"), ==, "Some text to transport via
option");
+ g_assert_true (gdk_pixbuf_remove_option (pixbuf2, "tEXt::option1"));
+ g_assert_null (gdk_pixbuf_get_option (pixbuf2, "tEXt::option1"));
+ g_assert_false (gdk_pixbuf_remove_option (pixbuf2, "tEXt::option1"));
+#ifdef PNG_iTXt_SUPPORTED
+ gdk_pixbuf_remove_option (pixbuf2, "tEXt::3");
+#endif
+ gdk_pixbuf_remove_option (pixbuf2, "tEXt::long-option-name123456789123456789123456789");
+ g_assert_false (gdk_pixbuf_remove_option (pixbuf2, "tEXt::option1"));
+
+ g_object_unref (pixbuf2);
g_object_unref (pixbuf);
g_object_unref (ref);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]