[perl-Gtk2] Wrap and test gdk_pixbuf_get_option



commit d38cf7d52c5c81088b3dd69152f973050551528a
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Sun Sep 26 19:09:58 2010 +0200

    Wrap and test gdk_pixbuf_get_option

 t/GdkPixbuf.t   |   12 +++++++++++-
 xs/GdkPixbuf.xs |    7 +++++++
 2 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/t/GdkPixbuf.t b/t/GdkPixbuf.t
index 9df2073..a78a5e7 100644
--- a/t/GdkPixbuf.t
+++ b/t/GdkPixbuf.t
@@ -1,6 +1,6 @@
 use strict;
 use warnings;
-use Gtk2::TestHelper tests => 103, noinit => 1;
+use Gtk2::TestHelper tests => 106, noinit => 1;
 
 my $show = 0;
 
@@ -225,6 +225,16 @@ is ($pixbuf->get_option ('tEXt::Thumb::MTime'), $mtime, 'get_option works');
 ok (! $pixbuf->get_option ('tEXt::noneXIStenTTag'),
     'get_option returns undef if the key is not found');
 
+SKIP: {
+	skip 'new 2.2 stuff', 3
+		unless Gtk2->CHECK_VERSION(2, 2, 0);
+
+	ok (! $pixbuf->set_option ('tEXt::Description', reverse $desc),
+	    'set_option refuses to overwrite');
+	ok ($pixbuf->set_option ('tEXt::woot', 'whee'));
+	is ($pixbuf->get_option ('tEXt::woot'), 'whee');
+}
+
 unlink $filename;
 
 
diff --git a/xs/GdkPixbuf.xs b/xs/GdkPixbuf.xs
index 31da76f..14274cc 100644
--- a/xs/GdkPixbuf.xs
+++ b/xs/GdkPixbuf.xs
@@ -19,6 +19,7 @@
  * $Id$
  */
 
+#define GDK_PIXBUF_ENABLE_BACKEND 1 /* for gdk_pixbuf_set_option() prototype */
 #include "gtk2perl.h"
 
 static void
@@ -336,6 +337,12 @@ gdk_pixbuf_get_option (pixbuf, key)
 	GdkPixbuf * pixbuf
 	const gchar * key
 
+#if GTK_CHECK_VERSION (2, 2, 0)
+
+gboolean gdk_pixbuf_set_option (GdkPixbuf *pixbuf, const gchar *key, const gchar *value);
+
+#endif /* 2.2 */
+
 ##  GdkPixbuf *gdk_pixbuf_new (GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample, int width, int height) 
 GdkPixbuf_noinc *
 gdk_pixbuf_new (class, colorspace, has_alpha, bits_per_sample, width, height)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]