[pygobject] Add test for a signal that returns a GParamSpec
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Add test for a signal that returns a GParamSpec
- Date: Mon, 3 Sep 2012 14:07:27 +0000 (UTC)
commit 69fb92c22b3f3d1d5e8c3e14134eee3242fdc5fc
Author: Martin Pitt <martinpitt gnome org>
Date: Mon Sep 3 16:06:49 2012 +0200
Add test for a signal that returns a GParamSpec
https://bugzilla.gnome.org/show_bug.cgi?id=683265
tests/test_signal.py | 6 ++++++
tests/testhelpermodule.c | 12 ++++++++++++
2 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/tests/test_signal.py b/tests/test_signal.py
index bff823b..d63d3fc 100644
--- a/tests/test_signal.py
+++ b/tests/test_signal.py
@@ -359,6 +359,7 @@ class CM(GObject.GObject):
test_double=(l, gdouble, (gdouble, )),
test_string=(l, str, (str, )),
test_object=(l, object, (object, )),
+ test_paramspec=(l, GObject.ParamSpec, ()),
)
@@ -396,6 +397,11 @@ class _TestCMarshaller:
rv = self.obj.emit("test-object", self)
self.assertEqual(rv, self)
+ def testTestReturnParamSpec(self):
+ rv = self.obj.emit("test-paramspec")
+ self.assertEqual(rv.name, "test-param")
+ self.assertEqual(rv.nick, "test")
+
if 'generic-c-marshaller' in GObject.features:
class TestCMarshaller(_TestCMarshaller, unittest.TestCase):
pass
diff --git a/tests/testhelpermodule.c b/tests/testhelpermodule.c
index d26ec9f..cd178a1 100644
--- a/tests/testhelpermodule.c
+++ b/tests/testhelpermodule.c
@@ -339,6 +339,14 @@ test_object_callback (GObject *object, GObject *o)
return o;
}
+static GParamSpec *
+test_paramspec_callback (GObject *object)
+{
+ g_return_val_if_fail (G_IS_OBJECT (object), NULL);
+
+ return g_param_spec_boolean ("test-param", "test", "test boolean", TRUE, G_PARAM_READABLE);
+}
+
static void
connectcallbacks (GObject *object)
{
@@ -381,6 +389,10 @@ connectcallbacks (GObject *object)
"test_object",
G_CALLBACK (test_object_callback),
NULL);
+ g_signal_connect (G_OBJECT (object),
+ "test_paramspec",
+ G_CALLBACK (test_paramspec_callback),
+ NULL);
}
static PyObject *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]