dbus/glib dbus-gobject.c,1.45,1.46
Colin Walters
walters at freedesktop.org
Thu Aug 4 09:21:51 EST 2005
- Previous message: dbus ChangeLog,1.869,1.870
- Next message: dbus/glib dbus-gvalue.h, 1.6, 1.7 dbus-gvalue.c, 1.20,
1.21 dbus-gvalue-utils.h, 1.3, 1.4 dbus-gvalue-utils.c, 1.5,
1.6 dbus-gsignature.h, NONE, 1.1 dbus-gsignature.c, NONE,
1.1 dbus-gproxy.c, 1.39, 1.40 dbus-gobject.c, 1.46,
1.47 dbus-gmain.c, 1.45, 1.46 dbus-binding-tool-glib.c, 1.20,
1.21 Makefile.am, 1.25, 1.26
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/dbus/dbus/glib
In directory gabe:/tmp/cvs-serv25396/glib
Modified Files:
dbus-gobject.c
Log Message:
2005-08-03 Colin Walters <walters at verbum.org>
* glib/dbus-gobject.c: Add tests on hardcoded object info; this should
catch any incompatible changes accidentally made.
Index: dbus-gobject.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gobject.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- dbus-gobject.c 1 Aug 2005 16:07:19 -0000 1.45
+++ dbus-gobject.c 3 Aug 2005 23:21:49 -0000 1.46
@@ -1931,6 +1931,57 @@
#ifdef DBUS_BUILD_TESTS
#include <stdlib.h>
+static void
+_dummy_function (void)
+{
+}
+
+/* Data structures copied from one generated by current dbus-binding-tool;
+ * we need to support this layout forever
+ */
+static const DBusGMethodInfo dbus_glib_internal_test_methods[] = {
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 0 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 49 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 117 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 191 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 270 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 320 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 391 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 495 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 623 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 693 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 765 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 838 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 911 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 988 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 1064 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 1140 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 1204 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 1278 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 1347 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 1408 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 1460 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 1533 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 1588 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 1647 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 1730 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 1784 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 1833 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 1895 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 1947 },
+ { (GCallback) _dummy_function, g_cclosure_marshal_VOID__VOID, 1999 },
+};
+
+const DBusGObjectInfo dbus_glib_internal_test_object_info = {
+ 0,
+ dbus_glib_internal_test_methods,
+ 30,
+"org.freedesktop.DBus.Tests.MyObject\0DoNothing\0S\0\0org.freedesktop.DBus.Tests.MyObject\0Increment\0S\0x\0I\0u\0arg1\0O\0F\0N\0u\0\0org.freedesktop.DBus.Tests.MyObject\0IncrementRetval\0S\0x\0I\0u\0arg1\0O\0F\0R\0u\0\0org.freedesktop.DBus.Tests.MyObject\0IncrementRetvalError\0S\0x\0I\0u\0arg1\0O\0F\0E\0u\0\0org.freedesktop.DBus.Tests.MyObject\0ThrowError\0S\0\0org.freedesktop.DBus.Tests.MyObject\0Uppercase\0S\0arg0\0I\0s\0arg1\0O\0F\0N\0s\0\0org.freedesktop.DBus.Tests.MyObject\0ManyArgs\0S\0x\0I\0u\0str\0I\0s\0trouble\0I\0d\0d_ret\0O\0F\0N\0d\0str_ret\0O\0F\0N\0s\0\0org.freedesktop.DBus.Tests.MyObject\0ManyReturn\0S\0arg0\0O\0F\0N\0u\0arg1\0O\0F\0N\0s\0arg2\0O\0F\0N\0i\0arg3\0O\0F\0N\0u\0arg4\0O\0F\0N\0u\0arg5\0O\0C\0N\0s\0\0org.freedesktop.DBus.Tests.MyObject\0Stringify\0S\0val\0I\0v\0arg1\0O\0F\0N\0s\0\0org.freedesktop.DBus.Tests.MyObject\0Unstringify\0S\0val\0I\0s\0arg1\0O\0F\0N\0v\0\0org.freedesktop.DBus.Tests.MyObject\0Recursive1\0S\0arg0\0I\0au\0arg1\0O\0F\0N\0u\0\0org.freedesktop.DBus.Tests.MyObject\0Recursive2\0S\0arg0\0I\0u\0arg1\0O\0F\0N\0au\0\0org.freedesktop.DBus.Tests.MyObject\0ManyUppercase\0S\0arg0\0I\0as\0arg1\0O\0F\0N\0as\0\0org.freedesktop.DBus.Tests.MyObject\0StrHashLen\0S\0arg0\0I\0a{ss}\0arg1\0O\0F\0N\0u\0\0org.freedesktop.DBus.Tests.MyObject\0SendCar\0S\0arg0\0I\0(suv)\0arg1\0O\0F\0N\0(uo)\0\0org.freedesktop.DBus.Tests.MyObject\0GetHash\0S\0arg0\0O\0F\0N\0a{ss}\0\0org.freedesktop.DBus.Tests.MyObject\0RecArrays\0S\0val\0I\0aas\0arg1\0O\0F\0N\0aau\0\0org.freedesktop.DBus.Tests.MyObject\0Objpath\0S\0arg0\0I\0o\0arg1\0O\0C\0N\0o\0\0org.freedesktop.DBus.Tests.MyObject\0GetObjs\0S\0arg0\0O\0F\0N\0ao\0\0org.freedesktop.DBus.Tests.MyObject\0IncrementVal\0S\0\0org.freedesktop.DBus.Tests.MyObject\0AsyncIncrement\0A\0x\0I\0u\0arg1\0O\0F\0N\0u\0\0org.freedesktop.DBus.Tests.MyObject\0AsyncThrowError\0A\0\0org.freedesktop.DBus.Tests.MyObject\0GetVal\0S\0arg0\0O\0F\0N\0u\0\0org.freedesktop.DBus.Tests.MyObject\0ManyStringify\0S\0arg0\0I\0a{sv}\0arg1\0O\0F\0N\0a{sv}\0\0org.freedesktop.DBus.Tests.MyObject\0EmitFrobnicate\0S\0\0org.freedesktop.DBus.Tests.MyObject\0Terminate\0S\0\0org.freedesktop.DBus.Tests.FooObject\0GetValue\0S\0arg0\0O\0F\0N\0u\0\0org.freedesktop.DBus.Tests.FooObject\0EmitSignals\0S\0\0org.freedesktop.DBus.Tests.FooObject\0EmitSignal2\0S\0\0org.freedesktop.DBus.Tests.FooObject\0Terminate\0S\0\0\0",
+"org.freedesktop.DBus.Tests.MyObject\0Frobnicate\0org.freedesktop.DBus.Tests.FooObject\0Sig0\0org.freedesktop.DBus.Tests.FooObject\0Sig1\0org.freedesktop.DBus.Tests.FooObject\0Sig2\0\0",
+"\0"
+};
+
+
/**
* @ingroup DBusGLibInternals
* Unit test for GLib GObject integration ("skeletons")
@@ -1940,6 +1991,16 @@
_dbus_gobject_test (const char *test_data_dir)
{
int i;
+ const char *arg;
+ const char *arg_name;
+ gboolean arg_in;
+ gboolean constval;
+ RetvalType retval;
+ const char *arg_signature;
+ const char *sigdata;
+ const char *iface;
+ const char *signame;
+
static struct { const char *wincaps; const char *uscore; } name_pairs[] = {
{ "SetFoo", "set_foo" },
{ "Foo", "foo" },
@@ -1950,6 +2011,95 @@
/* { "FrobateUIHandler", "frobate_ui_handler" } */
};
+ /* Test lookup in our hardcoded object info; if these tests fail
+ * then it likely means you changed the generated object info in an
+ * incompatible way and broke the lookup functions. In that case
+ * you need to bump the version and use a new structure instead. */
+ /* DoNothing */
+ arg = method_arg_info_from_object_info (&dbus_glib_internal_test_object_info,
+ &(dbus_glib_internal_test_methods[0]));
+ g_assert (*arg == '\0');
+
+ /* Increment */
+ arg = method_arg_info_from_object_info (&dbus_glib_internal_test_object_info,
+ &(dbus_glib_internal_test_methods[1]));
+ g_assert (*arg != '\0');
+ arg = arg_iterate (arg, &arg_name, &arg_in, &constval, &retval, &arg_signature);
+ g_assert (!strcmp (arg_name, "x"));
+ g_assert (arg_in == TRUE);
+ g_assert (!strcmp (arg_signature, "u"));
+ g_assert (*arg != '\0');
+ arg = arg_iterate (arg, &arg_name, &arg_in, &constval, &retval, &arg_signature);
+ g_assert (arg_in == FALSE);
+ g_assert (retval == RETVAL_NONE);
+ g_assert (!strcmp (arg_signature, "u"));
+ g_assert (*arg == '\0');
+
+ /* IncrementRetval */
+ arg = method_arg_info_from_object_info (&dbus_glib_internal_test_object_info,
+ &(dbus_glib_internal_test_methods[2]));
+ g_assert (*arg != '\0');
+ arg = arg_iterate (arg, &arg_name, &arg_in, &constval, &retval, &arg_signature);
+ g_assert (!strcmp (arg_name, "x"));
+ g_assert (arg_in == TRUE);
+ g_assert (!strcmp (arg_signature, "u"));
+ g_assert (*arg != '\0');
+ arg = arg_iterate (arg, &arg_name, &arg_in, &constval, &retval, &arg_signature);
+ g_assert (retval == RETVAL_NOERROR);
+ g_assert (arg_in == FALSE);
+ g_assert (!strcmp (arg_signature, "u"));
+ g_assert (*arg == '\0');
+
+ /* IncrementRetvalError */
+ arg = method_arg_info_from_object_info (&dbus_glib_internal_test_object_info,
+ &(dbus_glib_internal_test_methods[3]));
+ g_assert (*arg != '\0');
+ arg = arg_iterate (arg, &arg_name, &arg_in, &constval, &retval, &arg_signature);
+ g_assert (!strcmp (arg_name, "x"));
+ g_assert (arg_in == TRUE);
+ g_assert (!strcmp (arg_signature, "u"));
+ g_assert (*arg != '\0');
+ arg = arg_iterate (arg, &arg_name, &arg_in, &constval, &retval, &arg_signature);
+ g_assert (retval == RETVAL_ERROR);
+ g_assert (arg_in == FALSE);
+ g_assert (!strcmp (arg_signature, "u"));
+ g_assert (*arg == '\0');
+
+ /* Stringify */
+ arg = method_arg_info_from_object_info (&dbus_glib_internal_test_object_info,
+ &(dbus_glib_internal_test_methods[8]));
+ g_assert (*arg != '\0');
+ arg = arg_iterate (arg, &arg_name, &arg_in, &constval, &retval, &arg_signature);
+ g_assert (!strcmp (arg_name, "val"));
+ g_assert (arg_in == TRUE);
+ g_assert (!strcmp (arg_signature, "v"));
+ g_assert (*arg != '\0');
+ arg = arg_iterate (arg, &arg_name, &arg_in, &constval, &retval, &arg_signature);
+ g_assert (retval == RETVAL_NONE);
+ g_assert (arg_in == FALSE);
+ g_assert (!strcmp (arg_signature, "s"));
+ g_assert (*arg == '\0');
+
+ sigdata = dbus_glib_internal_test_object_info.exported_signals;
+ g_assert (*sigdata != '\0');
+ sigdata = propsig_iterate (sigdata, &iface, &signame);
+ g_assert (!strcmp (iface, "org.freedesktop.DBus.Tests.MyObject"));
+ g_assert (!strcmp (signame, "Frobnicate"));
+ g_assert (*sigdata != '\0');
+ sigdata = propsig_iterate (sigdata, &iface, &signame);
+ g_assert (!strcmp (iface, "org.freedesktop.DBus.Tests.FooObject"));
+ g_assert (!strcmp (signame, "Sig0"));
+ g_assert (*sigdata != '\0');
+ sigdata = propsig_iterate (sigdata, &iface, &signame);
+ g_assert (!strcmp (iface, "org.freedesktop.DBus.Tests.FooObject"));
+ g_assert (!strcmp (signame, "Sig1"));
+ g_assert (*sigdata != '\0');
+ sigdata = propsig_iterate (sigdata, &iface, &signame);
+ g_assert (!strcmp (iface, "org.freedesktop.DBus.Tests.FooObject"));
+ g_assert (!strcmp (signame, "Sig2"));
+ g_assert (*sigdata == '\0');
+
+
i = 0;
while (i < (int) G_N_ELEMENTS (name_pairs))
{
- Previous message: dbus ChangeLog,1.869,1.870
- Next message: dbus/glib dbus-gvalue.h, 1.6, 1.7 dbus-gvalue.c, 1.20,
1.21 dbus-gvalue-utils.h, 1.3, 1.4 dbus-gvalue-utils.c, 1.5,
1.6 dbus-gsignature.h, NONE, 1.1 dbus-gsignature.c, NONE,
1.1 dbus-gproxy.c, 1.39, 1.40 dbus-gobject.c, 1.46,
1.47 dbus-gmain.c, 1.45, 1.46 dbus-binding-tool-glib.c, 1.20,
1.21 Makefile.am, 1.25, 1.26
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dbus-commit
mailing list