seed r239 - in trunk: libseed tests



Author: racarr
Date: Tue Nov 11 09:32:32 2008
New Revision: 239
URL: http://svn.gnome.org/viewvc/seed?rev=239&view=rev

Log:
Exception when parent_type is not a GType/number.


Added:
   trunk/tests/gtype-typerror.js   (contents, props changed)
Modified:
   trunk/libseed/seed-gtype.c
   trunk/libseed/seed-types.c
   trunk/tests/Makefile.am

Modified: trunk/libseed/seed-gtype.c
==============================================================================
--- trunk/libseed/seed-gtype.c	(original)
+++ trunk/libseed/seed-gtype.c	Tue Nov 11 09:32:32 2008
@@ -453,6 +453,8 @@
 	seed_make_exception(exception, "ArgumentError",
 			    "GType constructor expected a"
 			    "class definition object. Got a nonobject");
+
+	return (JSObjectRef)JSValueMakeNull(eng->context);
     }
     parent_ref = seed_value_get_property(arguments[0], "parent");
     class_init = seed_value_get_property(arguments[0], "class_init");
@@ -466,6 +468,8 @@
 	seed_make_exception(exception, "TypeError",
 			    "GType constructor expected"
 			    " Gype for parent");
+	
+	return (JSObjectRef)JSValueMakeNull(eng->context);
     }
     if (!JSValueIsNull(eng->context, class_init) &&
 	JSValueIsObject(eng->context, class_init) &&

Modified: trunk/libseed/seed-types.c
==============================================================================
--- trunk/libseed/seed-types.c	(original)
+++ trunk/libseed/seed-types.c	Tue Nov 11 09:32:32 2008
@@ -302,7 +302,7 @@
 		    arg->v_pointer = NULL;
 		    break;
 		}
-		if (JSValueIsObjectOfClass(eng->context,
+		else if (JSValueIsObjectOfClass(eng->context,
 					   value, gobject_method_class))
 		{
 		    GIFunctionInfo *info =

Modified: trunk/tests/Makefile.am
==============================================================================
--- trunk/tests/Makefile.am	(original)
+++ trunk/tests/Makefile.am	Tue Nov 11 09:32:32 2008
@@ -3,6 +3,7 @@
     compare.js \
     constructor-args.js \
     signal-this.js \
+    gtype-typerror.js
     gtype-signal.js \
     signal-userdata.js \
     gtype-signal-exception.js \

Added: trunk/tests/gtype-typerror.js
==============================================================================
--- (empty file)
+++ trunk/tests/gtype-typerror.js	Tue Nov 11 09:32:32 2008
@@ -0,0 +1,16 @@
+#!/usr/local/bin/seed
+// Returns: 0
+// STDIN:
+// STDOUT:GType constructor expected Gype for parent
+// STDERR:
+Seed.import_namespace("Gtk");
+
+
+HelloWindowType = {
+    parent: "Mom",
+    name: "HelloWindow"
+};
+
+try{
+    HelloWindow = new GType(HelloWindowType);
+} catch (e) {Seed.print(e.message);}



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