dbus/test/glib test-dbus-glib.c, 1.31, 1.32 test-service-glib.c,
1.25, 1.26 test-service-glib.xml, 1.14, 1.15
John Palmieri
johnp at freedesktop.org
Wed Oct 5 13:43:49 PDT 2005
- Previous message: dbus/python Makefile.am, 1.20, 1.21 dbus_bindings.pyx, 1.8,
1.9 exceptions.py, 1.2, 1.3 proxies.py, 1.8, 1.9 service.py,
1.6, 1.7
- Next message: dbus/test/python test-client.py,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/dbus/dbus/test/glib
In directory gabe:/tmp/cvs-serv16663/test/glib
Modified Files:
test-dbus-glib.c test-service-glib.c test-service-glib.xml
Log Message:
* glib/dbus-gvalue.c (marshal_variant): call _dbus_gvalue_marshal
instead of marshal basic so we can handle recursive types in a variant
* test/glib/test-dbus-glib.c: Add test for marshaling recurive types
in variants
* test/glib/test-service-glib.c, test-service-glib.xml
(my_object_echo_variant [EchoVariant],
my_object_process_variant_of_array_of_ints123
[ProcessVariantOfArrayOfInts123]):
Add two test methods
* python/introspect_parser.py: New module for parsing introspect
data.
* python/dbus_bindings.pyx:
(various places): when throwing errors fix to use errormsg instead
of message local variable because Pyrex can get confused with other
message variables (initial patch by Robert McQueen
<robert.mcqueen at collabora.co.uk>)
(MessageIter::parse_signature_block): new method for getting the next
block in a signiture.
(MessageIter::append_strict): new method for appending values strictly
using the passed in signature instead of guessing at the type
(MessageItter:: append_dict, append_struct, append_array): use
signatures to marshal children if the signature is available
* python/exceptions.py (IntrospectionParserException): new exception
* python/proxies.py (ProxyMethod::__call__): Marshal args with
introspected signatures if available, else we fall back to the
old way of doing things.
(ProxyObject::_introspect_reply_handler ): parse introspection data
* python/service.py (ObjectType::_reflect_on_method): Properly
terminate <method> if there are no args in the reflection data
* test/python/test-client.py: add tests for talking with the GLib
test server. This gives us better coverage for introspection since
python to python will always generate arguments as variants. It also
allows us to test the robustness of the GLib bindings and interlanguage
communications.
Index: test-dbus-glib.c
===================================================================
RCS file: /cvs/dbus/dbus/test/glib/test-dbus-glib.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- test-dbus-glib.c 24 Jul 2005 18:04:23 -0000 1.31
+++ test-dbus-glib.c 5 Oct 2005 20:43:46 -0000 1.32
@@ -1138,7 +1138,34 @@
g_free (g_ptr_array_index (objs, i));
g_ptr_array_free (objs, TRUE);
}
+
+ {
+ GValue *variant;
+ GArray *array;
+ gint i;
+
+ g_print ("Calling ProcessVariantOfArrayOfInts123\n");
+ array = g_array_sized_new (FALSE, FALSE, sizeof(gint), 3);
+ i = 1;
+ g_array_append_val (array, i);
+ i++;
+ g_array_append_val (array, i);
+ i++;
+ g_array_append_val (array, i);
+
+ variant = g_new0 (GValue, 1);
+ g_value_init (variant, dbus_g_type_get_collection ("GArray", G_TYPE_INT));
+ g_value_set_boxed_take_ownership (variant, array);
+
+ if (!dbus_g_proxy_call (proxy, "ProcessVariantOfArrayOfInts123", &error,
+ G_TYPE_VALUE, variant,
+ G_TYPE_INVALID,
+ G_TYPE_INVALID))
+ lose_gerror ("Failed to send a vairant of array of ints 1, 2 and 3!", error);
+
+ g_value_unset (variant);
+ }
/* Signal handling tests */
g_print ("Testing signal handling\n");
Index: test-service-glib.c
===================================================================
RCS file: /cvs/dbus/dbus/test/glib/test-service-glib.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- test-service-glib.c 4 Aug 2005 15:49:30 -0000 1.25
+++ test-service-glib.c 5 Oct 2005 20:43:46 -0000 1.26
@@ -97,6 +97,10 @@
gboolean my_object_emit_frobnicate (MyObject *obj, GError **error);
+gboolean my_object_echo_variant (MyObject *obj, GValue *variant, GValue *ret, GError **error);
+
+gboolean my_object_process_variant_of_array_of_ints123 (MyObject *obj, GValue *variant, GError **error);
+
gboolean my_object_terminate (MyObject *obj, GError **error);
void my_object_async_increment (MyObject *obj, gint32 x, DBusGMethodInvocation *context);
@@ -664,6 +668,43 @@
}
gboolean
+my_object_echo_variant (MyObject *obj, GValue *variant, GValue *ret, GError **error)
+{
+ g_value_init (ret, G_VALUE_TYPE(variant));
+ g_value_copy (variant, ret);
+
+ return TRUE;
+}
+
+gboolean
+my_object_process_variant_of_array_of_ints123 (MyObject *obj, GValue *variant, GError **error)
+{
+ GArray *array;
+ int i;
+ int j;
+
+ j = 0;
+
+ array = (GArray *)g_value_get_boxed (variant);
+
+ for (i = 0; i <= 2; i++)
+ {
+ j = g_array_index (array, int, i);
+ if (j != i + 1)
+ goto error;
+ }
+
+ return TRUE;
+
+error:
+ *error = g_error_new (MY_OBJECT_ERROR,
+ MY_OBJECT_ERROR_FOO,
+ "Error decoding a variant of type ai (i + 1 = %i, j = %i)",
+ i, j + 1);
+ return FALSE;
+}
+
+gboolean
my_object_emit_frobnicate (MyObject *obj, GError **error)
{
g_signal_emit (obj, signals[FROBNICATE], 0, 42);
Index: test-service-glib.xml
===================================================================
RCS file: /cvs/dbus/dbus/test/glib/test-service-glib.xml,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- test-service-glib.xml 24 Jul 2005 18:04:23 -0000 1.14
+++ test-service-glib.xml 5 Oct 2005 20:43:46 -0000 1.15
@@ -128,6 +128,15 @@
<arg type="a{sv}" direction="out"/>
</method>
+ <method name="EchoVariant">
+ <arg type="v" direction="in" />
+ <arg type="v" direction="out" />
+ </method>
+
+ <method name="ProcessVariantOfArrayOfInts123">
+ <arg type="v" direction="in" />
+ </method>
+
<method name="EmitFrobnicate">
</method>
- Previous message: dbus/python Makefile.am, 1.20, 1.21 dbus_bindings.pyx, 1.8,
1.9 exceptions.py, 1.2, 1.3 proxies.py, 1.8, 1.9 service.py,
1.6, 1.7
- Next message: dbus/test/python test-client.py,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dbus-commit
mailing list