[pygobject] Test gint64 C signal arguments and return values
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Test gint64 C signal arguments and return values
- Date: Mon, 10 Sep 2012 14:47:02 +0000 (UTC)
commit 15046b5a11f6c58a3e5a9c50cf0ce7f31f2cd55f
Author: Martin Pitt <martinpitt gnome org>
Date: Mon Sep 10 16:46:30 2012 +0200
Test gint64 C signal arguments and return values
tests/test_signal.py | 12 ++++++++++++
tests/testhelpermodule.c | 14 ++++++++++++++
2 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/tests/test_signal.py b/tests/test_signal.py
index 2002c18..80f5a2b 100644
--- a/tests/test_signal.py
+++ b/tests/test_signal.py
@@ -347,6 +347,7 @@ gfloat = GObject.TYPE_FLOAT
gdouble = GObject.TYPE_DOUBLE
guint = GObject.TYPE_UINT
gulong = GObject.TYPE_ULONG
+gint64 = GObject.TYPE_INT64
class CM(GObject.GObject):
@@ -357,6 +358,7 @@ class CM(GObject.GObject):
test4=(f, None, (bool, _long, gfloat, gdouble, int, guint, gulong)),
test_float=(l, gfloat, (gfloat,)),
test_double=(l, gdouble, (gdouble, )),
+ test_int64=(l, gint64, (gint64, )),
test_string=(l, str, (str, )),
test_object=(l, object, (object, )),
test_paramspec=(l, GObject.ParamSpec, ()),
@@ -391,6 +393,16 @@ class _TestCMarshaller:
rv = self.obj.emit("test-double", 1.234)
self.assertEqual(rv, 1.234)
+ def testTestReturnInt64(self):
+ rv = self.obj.emit("test-int64", 102030405)
+ self.assertEqual(rv, 102030405)
+
+ rv = self.obj.emit("test-int64", GObject.G_MAXINT64)
+ self.assertEqual(rv, GObject.G_MAXINT64 - 1)
+
+ rv = self.obj.emit("test-int64", GObject.G_MININT64)
+ self.assertEqual(rv, GObject.G_MININT64)
+
def testTestReturnString(self):
rv = self.obj.emit("test-string", "str")
self.assertEqual(rv, "str")
diff --git a/tests/testhelpermodule.c b/tests/testhelpermodule.c
index cd178a1..d9036db 100644
--- a/tests/testhelpermodule.c
+++ b/tests/testhelpermodule.c
@@ -322,6 +322,16 @@ test_double_callback (GObject *object, double d)
return d;
}
+static gint64 *
+test_int64_callback (GObject *object, gint64 i)
+{
+ g_return_val_if_fail (G_IS_OBJECT (object), -1);
+
+ if (i == G_MAXINT64)
+ return i-1;
+ return i;
+}
+
static char *
test_string_callback (GObject *object, char *s)
{
@@ -382,6 +392,10 @@ connectcallbacks (GObject *object)
G_CALLBACK (test_double_callback),
NULL);
g_signal_connect (G_OBJECT (object),
+ "test_int64",
+ G_CALLBACK (test_int64_callback),
+ NULL);
+ g_signal_connect (G_OBJECT (object),
"test_string",
G_CALLBACK (test_string_callback),
NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]