Commit 4e4c87e3 authored by Nicolas Dufresne's avatar Nicolas Dufresne Committed by Martin Pitt
Browse files

argument: Fix 64bit integer convertion from GValue



Trying to get a 64bit integer using the wrong getter was resulting in an
assertion and 0 being returned.
Co-Authored-By: default avatarMartin Pitt <martinpitt@gnome.org>

https://bugzilla.gnome.org/show_bug.cgi?id=683596
parent e474ce24
......@@ -1998,15 +1998,19 @@ _pygi_argument_from_g_value(const GValue *value,
case GI_TYPE_TAG_INT8:
case GI_TYPE_TAG_INT16:
case GI_TYPE_TAG_INT32:
case GI_TYPE_TAG_INT64:
arg.v_int = g_value_get_int (value);
break;
case GI_TYPE_TAG_INT64:
arg.v_int64 = g_value_get_int64 (value);
break;
case GI_TYPE_TAG_UINT8:
case GI_TYPE_TAG_UINT16:
case GI_TYPE_TAG_UINT32:
case GI_TYPE_TAG_UINT64:
arg.v_uint = g_value_get_uint (value);
break;
case GI_TYPE_TAG_UINT64:
arg.v_uint64 = g_value_get_uint64 (value);
break;
case GI_TYPE_TAG_UNICHAR:
arg.v_uint32 = g_value_get_schar (value);
break;
......
......@@ -694,6 +694,58 @@ class TestSignals(unittest.TestCase):
obj.connect('sig-with-obj', callback)
obj.emit_sig_with_obj()
def test_int64_param_from_py(self):
obj = Everything.TestObj()
def callback(obj, i):
obj.callback_i = i
return i
obj.callback_i = None
obj.connect('sig-with-int64-prop', callback)
rv = obj.emit('sig-with-int64-prop', GObject.G_MAXINT64)
self.assertEqual(rv, GObject.G_MAXINT64)
self.assertEqual(obj.callback_i, GObject.G_MAXINT64)
def test_uint64_param_from_py(self):
obj = Everything.TestObj()
def callback(obj, i):
obj.callback_i = i
return i
obj.callback_i = None
obj.connect('sig-with-uint64-prop', callback)
rv = obj.emit('sig-with-uint64-prop', GObject.G_MAXUINT64)
self.assertEqual(rv, GObject.G_MAXUINT64)
self.assertEqual(obj.callback_i, GObject.G_MAXUINT64)
def test_int64_param_from_c(self):
obj = Everything.TestObj()
def callback(obj, i):
obj.callback_i = i
return i
obj.callback_i = None
obj.connect('sig-with-int64-prop', callback)
obj.emit_sig_with_int64()
self.assertEqual(obj.callback_i, GObject.G_MAXINT64)
def test_uint64_param_from_c(self):
obj = Everything.TestObj()
def callback(obj, i):
obj.callback_i = i
return i
obj.callback_i = None
obj.connect('sig-with-uint64-prop', callback)
obj.emit_sig_with_uint64()
self.assertEqual(obj.callback_i, GObject.G_MAXUINT64)
class TestPango(unittest.TestCase):
@unittest.skipUnless(Gtk, 'Gtk not available')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment