[perl-Glib] Glib::ParamSpec->string: allow undef for default_value



commit 6e23ca103de64b288fd5f7f7596b45a7903b4d72
Author: Kevin Ryde <user42 zip com au>
Date:   Sat Apr 17 08:13:44 2010 +1000

    Glib::ParamSpec->string: allow undef for default_value
    
    https://bugzilla.gnome.org/show_bug.cgi?id=616059

 GParamSpec.xs |    6 +++++-
 t/e.t         |   11 ++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/GParamSpec.xs b/GParamSpec.xs
index 98e4642..5a189a3 100644
--- a/GParamSpec.xs
+++ b/GParamSpec.xs
@@ -489,12 +489,16 @@ g_param_spec_double (class, name, nick, blurb, minimum, maximum, default_value,
 	RETVAL
 
 ##  GParamSpec* g_param_spec_string (const gchar *name, const gchar *nick, const gchar *blurb, const gchar *default_value, GParamFlags flags) 
+##
+## "default_value" can be NULL.  Not actually described in the docs as
+## of 2.18, but used that way in lots of the builtin classes
+##
 GParamSpec*
 g_param_spec_string (class, name, nick, blurb, default_value, flags)
 	const gchar *name
 	const gchar *nick
 	const gchar *blurb
-	const gchar *default_value
+	const gchar_ornull *default_value
 	GParamFlags flags
     C_ARGS:
 	name, nick, blurb, default_value, flags
diff --git a/t/e.t b/t/e.t
index 1f344ce..5d267d6 100644
--- a/t/e.t
+++ b/t/e.t
@@ -5,7 +5,7 @@
 use strict;
 use utf8;
 use Glib ':constants';
-use Test::More tests => 259;
+use Test::More tests => 273;
 
 # first register some types with which to play below.
 
@@ -65,6 +65,15 @@ ok ($pspec->get_default_value, "Boolean default (expect TRUE)");
 push @params, $pspec;
 
 
+$pspec = Glib::ParamSpec->string ('string', 'String',
+				  'Stringing you along with NULL default.',
+				  undef,
+				  'readable');
+pspec_common_ok ($pspec, 'String', 'readable', 'Glib::String');
+is ($pspec->get_default_value, undef, "String default NULL");
+push @params, $pspec;
+
+
 #
 # all of the integer types have the same interface.
 #



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