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

Re: fetching unset GParamSpec property



Torsten Schoenfeld <kaffeetisch gmx de> writes:
>
> I just committed a patch that implements the latter approach.

Don't forget the constructors returning null for bad args too.

--- e.t	19 Aug 2008 09:04:49 +1000	1.3
+++ e.t	19 Aug 2008 09:40:31 +1000	
@@ -83,6 +83,11 @@
 	is ($pspec->get_maximum, $max, "$nick max");
 	is ($pspec->get_default_value, $default, "$nick default");
 	push @params, $pspec;
+
+        # min/max the wrong way around
+	is (Glib::ParamSpec->$name ($name, $nick, $blurb, $max, $min,
+                                    $default, $flags), undef,
+            "$nick undef from min > max args");
 }
 
 #
@@ -103,6 +108,11 @@
 	is_float ($pspec->get_default_value, $default, "$nick default");
 	ok ($pspec->get_epsilon > 0.0, "$nick epsilon");
 	push @params, $pspec;
+
+        # min/max the wrong way around
+	is (Glib::ParamSpec->$name ($name, $nick, $blurb, $max, $min,
+                                    $default, $flags), undef,
+            "$nick undef from min > max args");
 }
 
 
@@ -175,6 +185,10 @@
 isa_ok ($pspec, 'Glib::Param::Long', 'IV is actually Long');
 push @params, $pspec;
 
+is (Glib::ParamSpec->IV ('iv', 'IV', 'Blurb.', 10, -20, -5, G_PARAM_READWRITE),
+    undef,
+    "IV undef from min > max args");
+
 
 $pspec = Glib::ParamSpec->UV ('uv', 'UV',
 	                      'This is the same as UInt',
@@ -182,6 +196,10 @@
 isa_ok ($pspec, 'Glib::Param::ULong', 'UV is actually ULong');
 push @params, $pspec;
 
+is (Glib::ParamSpec->UV ('uv', 'uV', 'Blurb.', 20, 10, 15, G_PARAM_READWRITE),
+    undef,
+    "IV undef from min > max args");
+
 
 $pspec = Glib::ParamSpec->scalar ('scalar', 'Scalar',
 	                          'This is the same as Boxed',
-- 
"And the sign says long-haired freaky people need not apply."


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