summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGustavo J. A. M. Carneiro <gjc@src.gnome.org>2007-07-07 12:09:52 +0000
committerGustavo J. A. M. Carneiro <gjc@src.gnome.org>2007-07-07 12:09:52 +0000
commitfe3966c22cbf5e198164b088b4f46f280bc33126 (patch)
tree28011f1aa7ac20608923459f40edec802d11318a /tests
parent73b8042c42ede774597b5bc235a70f8f13643b91 (diff)
downloadpygobject-fe3966c22cbf5e198164b088b4f46f280bc33126.tar.gz
pygobject-fe3966c22cbf5e198164b088b4f46f280bc33126.tar.xz
pygobject-fe3966c22cbf5e198164b088b4f46f280bc33126.zip
Bug 351072 – Cannot handle signals with parameter type G_TYPE_VALUE (marshal/unmarshal for GValue-wrapped GValue)
svn path=/trunk/; revision=680
Diffstat (limited to 'tests')
-rw-r--r--tests/test_gtype.py5
-rw-r--r--tests/testhelpermodule.c19
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_gtype.py b/tests/test_gtype.py
index df75ccf..ad54dc6 100644
--- a/tests/test_gtype.py
+++ b/tests/test_gtype.py
@@ -64,6 +64,11 @@ class GTypeTest(unittest.TestCase):
def testObject(self):
self.checkType(gobject.TYPE_OBJECT, 'PyObject')
+ def testValue(self):
+ array = [1, "foo", True]
+ for i in array:
+ self.assertEqual(i, testhelper.test_value(i))
+
def testValueArray(self):
array = [1, 2, 3, "foo", True]
self.assertEqual(array, testhelper.test_value_array(array))
diff --git a/tests/testhelpermodule.c b/tests/testhelpermodule.c
index 8d9419e..d78cf55 100644
--- a/tests/testhelpermodule.c
+++ b/tests/testhelpermodule.c
@@ -451,6 +451,24 @@ _wrap_connectcallbacks(PyObject * self, PyObject *args)
}
static PyObject *
+_wrap_test_value(PyObject *self, PyObject *args)
+{
+ GValue tvalue = {0,}, *value = &tvalue;
+ PyObject *obj;
+
+ if (!PyArg_ParseTuple(args, "O", &obj))
+ return NULL;
+
+ g_value_init(value, G_TYPE_VALUE);
+ if (pyg_value_from_pyobject(value, obj)) {
+ PyErr_SetString(PyExc_TypeError, "Could not convert to GValue");
+ return NULL;
+ }
+
+ return pyg_value_as_pyobject(value, FALSE);
+}
+
+static PyObject *
_wrap_test_value_array(PyObject *self, PyObject *args)
{
GValue tvalue = {0,}, *value = &tvalue;
@@ -500,6 +518,7 @@ static PyMethodDef testhelper_functions[] = {
{ "create_test_type", (PyCFunction)_wrap_create_test_type, METH_NOARGS },
{ "test_g_object_new", (PyCFunction)_wrap_test_g_object_new, METH_NOARGS },
{ "connectcallbacks", (PyCFunction)_wrap_connectcallbacks, METH_VARARGS },
+ { "test_value", (PyCFunction)_wrap_test_value, METH_VARARGS },
{ "test_value_array", (PyCFunction)_wrap_test_value_array, METH_VARARGS },
{ "test_gerror_exception", (PyCFunction)_wrap_test_gerror_exception, METH_VARARGS },
{ NULL, NULL }