[gobject-introspection: 1/5] regress: Add test for interface signal
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection: 1/5] regress: Add test for interface signal
- Date: Thu, 21 Jun 2018 01:41:26 +0000 (UTC)
commit 4fa6c29987ac23ff1e1f094a3d0ef4c4bcdacf4f
Author: Philip Chimento <philip chimento gmail com>
Date: Wed May 9 23:36:50 2018 -0700
regress: Add test for interface signal
It includes a pointer parameter; for some reason, the pointer parameter
breaks g_object_info_find_signal() but a parameter-less signal doesn't.
See gjs#147.
tests/scanner/Regress-1.0-expected.gir | 24 ++++++++++++++++++++++++
tests/scanner/regress.c | 25 +++++++++++++++++++++++++
tests/scanner/regress.h | 3 +++
3 files changed, 52 insertions(+)
---
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index 39f5d05d..316c12ca 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -2907,6 +2907,30 @@ use it should be.</doc>
glib:type-name="RegressTestInterface"
glib:get-type="regress_test_interface_get_type"
glib:type-struct="TestInterfaceIface">
+ <method name="emit_signal"
+ c:identifier="regress_test_interface_emit_signal">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <instance-parameter name="self" transfer-ownership="none">
+ <doc xml:space="preserve">the object to emit the signal</doc>
+ <type name="TestInterface" c:type="RegressTestInterface*"/>
+ </instance-parameter>
+ </parameters>
+ </method>
+ <glib:signal name="interface-signal" when="last">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <parameter name="ptr" transfer-ownership="none">
+ <doc xml:space="preserve">the code must look up the signal with
+ g_interface_info_find_signal() in order to get this to work.</doc>
+ <type name="gint" c:type="gpointer"/>
+ </parameter>
+ </parameters>
+ </glib:signal>
</interface>
<record name="TestInterfaceIface"
c:type="RegressTestInterfaceIface"
diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c
index 3c186238..2cf4cddb 100644
--- a/tests/scanner/regress.c
+++ b/tests/scanner/regress.c
@@ -3908,6 +3908,31 @@ G_DEFINE_INTERFACE (RegressTestInterface, regress_test_interface, G_TYPE_OBJECT)
static void
regress_test_interface_default_init(RegressTestInterfaceIface *iface)
{
+ static gboolean initialized = FALSE;
+ if (initialized)
+ return;
+
+ /**
+ * RegressTestInterface::interface-signal:
+ * @self: the object which emitted the signal
+ * @ptr: (type int): the code must look up the signal with
+ * g_interface_info_find_signal() in order to get this to work.
+ */
+ g_signal_new ("interface-signal", REGRESS_TEST_TYPE_INTERFACE,
+ G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL,
+ G_TYPE_NONE, 1, G_TYPE_POINTER);
+
+ initialized = TRUE;
+}
+
+/**
+ * regress_test_interface_emit_signal:
+ * @self: the object to emit the signal
+ */
+void
+regress_test_interface_emit_signal (RegressTestInterface *self)
+{
+ g_signal_emit_by_name (self, "interface-signal", NULL);
}
/* gobject with non-standard prefix */
diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h
index 23b5792b..d88df3f2 100644
--- a/tests/scanner/regress.h
+++ b/tests/scanner/regress.h
@@ -1196,6 +1196,9 @@ struct _RegressTestInterfaceIface {
_GI_TEST_EXTERN
GType regress_test_interface_get_type (void) G_GNUC_CONST;
+_GI_TEST_EXTERN
+void regress_test_interface_emit_signal (RegressTestInterface *self);
+
/* gobject with non-standard prefix */
#define REGRESS_TEST_TYPE_WI_802_1X (regress_test_wi_802_1x_get_type ())
#define REGRESS_TEST_WI_802_1X(object) (G_TYPE_CHECK_INSTANCE_CAST ((object),
REGRESS_TEST_TYPE_WI_802_1X, RegressTestWi8021x))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]