summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2012-05-25 15:24:34 -0400
committerJasper St. Pierre <jstpierre@mecheye.net>2012-05-25 16:36:46 -0400
commita7bfba3ecef5d821fb14a9723746fde9665e1f38 (patch)
tree218d52d800d2e0fbab4e8e936615730f7a11ff76
parentfed7b258e9e1c8f25e6bfbe114de753fdf91a100 (diff)
downloadgobject-introspection-a7bfba3ecef5d821fb14a9723746fde9665e1f38.tar.gz
tests: Add a foreign struct signal test
https://bugzilla.gnome.org/show_bug.cgi?id=671687
-rw-r--r--configure.ac2
-rw-r--r--tests/scanner/Regress-1.0-expected.gir17
-rw-r--r--tests/scanner/regress.c27
-rw-r--r--tests/scanner/regress.h1
4 files changed, 46 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index e8fc72da..58b8015e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -132,7 +132,7 @@ AM_CONDITIONAL(HAVE_GIO_UNIX, test x$have_gio_unix = xtrue)
AC_ARG_ENABLE(tests,[ --disable-tests disable test libraries ], enable_tests=$enableval,enable_tests=yes)
have_cairo=no
-PKG_CHECK_MODULES(CAIRO, [cairo], have_cairo=yes, have_cairo=no)
+PKG_CHECK_MODULES(CAIRO, [cairo cairo-gobject], have_cairo=yes, have_cairo=no)
if test x$have_cairo != xyes && test x$enable_tests != xno; then
AC_MSG_ERROR([Tests enabled but cairo not found; pass --disable-tests or install cairo])
fi
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index 81c0a6ba..b1fd124e 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -621,6 +621,12 @@ case.</doc>
</parameter>
</parameters>
</method>
+ <method name="emit_sig_with_foreign_struct"
+ c:identifier="regress_test_obj_emit_sig_with_foreign_struct">
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ </method>
<method name="emit_sig_with_obj"
c:identifier="regress_test_obj_emit_sig_with_obj">
<return-value transfer-ownership="none">
@@ -1059,6 +1065,17 @@ raise an error.</doc>
</parameter>
</parameters>
</glib:signal>
+ <glib:signal name="sig-with-foreign-struct" when="last">
+ <return-value transfer-ownership="none">
+ <type name="none"/>
+ </return-value>
+ <parameters>
+ <parameter name="cr" transfer-ownership="none">
+ <doc xml:whitespace="preserve">A cairo context.</doc>
+ <type name="cairo.Context"/>
+ </parameter>
+ </parameters>
+ </glib:signal>
<glib:signal name="sig-with-hash-prop" when="last">
<doc xml:whitespace="preserve">This test signal is like TelepathyGlib's
TpAccount::status-changed</doc>
diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c
index 30ead90e..bcab7f8b 100644
--- a/tests/scanner/regress.c
+++ b/tests/scanner/regress.c
@@ -3,6 +3,7 @@
#include <stdlib.h>
#include <glib-object.h>
#include <gobject/gvaluecollector.h>
+#include <cairo-gobject.h>
#include "regress.h"
@@ -1996,6 +1997,7 @@ enum {
REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_HASH_PROP,
REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_STRV,
REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_OBJ,
+ REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_FOREIGN_STRUCT,
REGRESS_TEST_OBJ_SIGNAL_FIRST,
REGRESS_TEST_OBJ_SIGNAL_CLEANUP,
REGRESS_TEST_OBJ_SIGNAL_ALL,
@@ -2115,6 +2117,23 @@ regress_test_obj_class_init (RegressTestObjClass *klass)
1,
G_TYPE_OBJECT);
+ /**
+ * RegressTestObj::sig-with-foreign-struct:
+ * @self: an object
+ * @cr: (transfer none): A cairo context.
+ */
+ regress_test_obj_signals[REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_FOREIGN_STRUCT] =
+ g_signal_new ("sig-with-foreign-struct",
+ G_TYPE_FROM_CLASS (gobject_class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL,
+ NULL,
+ NULL,
+ G_TYPE_NONE,
+ 1,
+ CAIRO_GOBJECT_TYPE_CONTEXT);
+
regress_test_obj_signals[REGRESS_TEST_OBJ_SIGNAL_FIRST] =
g_signal_new ("first",
G_TYPE_FROM_CLASS (gobject_class),
@@ -2361,6 +2380,14 @@ regress_test_obj_emit_sig_with_obj (RegressTestObj *obj)
g_object_unref (obj_param);
}
+void
+regress_test_obj_emit_sig_with_foreign_struct (RegressTestObj *obj)
+{
+ cairo_t *cr = regress_test_cairo_context_full_return ();
+ g_signal_emit_by_name (obj, "sig-with-foreign-struct", cr);
+ cairo_destroy (cr);
+}
+
int
regress_test_obj_instance_method (RegressTestObj *obj)
{
diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h
index 15b8ce2e..eeab81be 100644
--- a/tests/scanner/regress.h
+++ b/tests/scanner/regress.h
@@ -382,6 +382,7 @@ RegressTestObj* regress_constructor (void);
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);
int regress_test_obj_instance_method (RegressTestObj *obj);
double regress_test_obj_static_method (int x);
void regress_forced_method (RegressTestObj *obj);