From 5959c29c7bfe046989674e9413355e79896f0e0d Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Tue, 11 Sep 2012 16:07:11 -0400 Subject: regress: Add API to test signals with (u)int64 params https://bugzilla.gnome.org/show_bug.cgi?id=683596 Co-Authored-By: Martin Pitt --- tests/scanner/Regress-1.0-expected.gir | 38 +++++++++++++++++++++ tests/scanner/regress.c | 62 ++++++++++++++++++++++++++++++++++ tests/scanner/regress.h | 2 ++ 3 files changed, 102 insertions(+) diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir index 1d826766..a3e77db1 100644 --- a/tests/scanner/Regress-1.0-expected.gir +++ b/tests/scanner/Regress-1.0-expected.gir @@ -742,12 +742,24 @@ case. + + + + + + + + + + @@ -1206,6 +1218,19 @@ raise an error. + + You can use this with regress_test_obj_emit_sig_with_int64, or raise from +the introspection client langage. + + + + + + an integer + + + + Test transfer none GObject as a param (tests refcounting). Use with regress_test_obj_emit_sig_with_obj @@ -1233,6 +1258,19 @@ Use with regress_test_obj_emit_sig_with_obj + + You can use this with regress_test_obj_emit_sig_with_uint64, or raise from +the introspection client langage. + + + + + + an integer + + + + diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c index e72c5aa7..2fba9fd5 100644 --- a/tests/scanner/regress.c +++ b/tests/scanner/regress.c @@ -2132,6 +2132,8 @@ enum { REGRESS_TEST_OBJ_SIGNAL_FIRST, REGRESS_TEST_OBJ_SIGNAL_CLEANUP, REGRESS_TEST_OBJ_SIGNAL_ALL, + REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_INT64_PROP, + REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_UINT64_PROP, N_REGRESS_TEST_OBJ_SIGNALS }; @@ -2298,6 +2300,46 @@ regress_test_obj_class_init (RegressTestObjClass *klass) G_TYPE_NONE, 0); + /** + * RegressTestObj::sig-with-int64-prop: + * @self: an object + * @i: an integer + * + * You can use this with regress_test_obj_emit_sig_with_int64, or raise from + * the introspection client langage. + */ + regress_test_obj_signals[REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_INT64_PROP] = + g_signal_new ("sig-with-int64-prop", + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + 0, + NULL, + NULL, + g_cclosure_marshal_VOID__BOXED, + G_TYPE_INT64, + 1, + G_TYPE_INT64); + + /** + * RegressTestObj::sig-with-uint64-prop: + * @self: an object + * @i: an integer + * + * You can use this with regress_test_obj_emit_sig_with_uint64, or raise from + * the introspection client langage. + */ + regress_test_obj_signals[REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_UINT64_PROP] = + g_signal_new ("sig-with-uint64-prop", + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + 0, + NULL, + NULL, + g_cclosure_marshal_VOID__BOXED, + G_TYPE_UINT64, + 1, + G_TYPE_UINT64); + gobject_class->set_property = regress_test_obj_set_property; gobject_class->get_property = regress_test_obj_get_property; gobject_class->dispose = regress_test_obj_dispose; @@ -2519,6 +2561,26 @@ regress_test_obj_emit_sig_with_foreign_struct (RegressTestObj *obj) cairo_destroy (cr); } +void +regress_test_obj_emit_sig_with_int64 (RegressTestObj *obj) +{ + gint64 ret = 0; + RegressTestObj *obj_param = regress_constructor (); + g_signal_emit_by_name (obj, "sig-with-int64-prop", G_MAXINT64, &ret); + g_object_unref (obj_param); + g_assert (ret == G_MAXINT64); +} + +void +regress_test_obj_emit_sig_with_uint64 (RegressTestObj *obj) +{ + guint64 ret = 0; + RegressTestObj *obj_param = regress_constructor (); + g_signal_emit_by_name (obj, "sig-with-uint64-prop", G_MAXUINT64, &ret); + g_object_unref (obj_param); + g_assert (ret == G_MAXUINT64); +} + int regress_test_obj_instance_method (RegressTestObj *obj) { diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h index 949a3764..f2dae494 100644 --- a/tests/scanner/regress.h +++ b/tests/scanner/regress.h @@ -479,6 +479,8 @@ RegressTestObj* regress_test_obj_new_from_file (const char *x, GError **error) void regress_test_obj_set_bare (RegressTestObj *obj, GObject *bare); void regress_test_obj_emit_sig_with_obj (RegressTestObj *obj); void regress_test_obj_emit_sig_with_foreign_struct (RegressTestObj *obj); +void regress_test_obj_emit_sig_with_int64 (RegressTestObj *obj); +void regress_test_obj_emit_sig_with_uint64 (RegressTestObj *obj); int regress_test_obj_instance_method (RegressTestObj *obj); double regress_test_obj_static_method (int x); void regress_forced_method (RegressTestObj *obj); -- cgit v1.2.1