[pygobject] closure: support unichar args



commit b23dea0981ab5718cb26d3a9f4f7bf8f593ac343
Author: Christoph Reiter <creiter src gnome org>
Date:   Sun Mar 26 19:11:33 2017 +0200

    closure: support unichar args
    
    https://bugzilla.gnome.org/show_bug.cgi?id=759276

 gi/pygi-closure.c           |    3 +++
 tests/test_overrides_gtk.py |   14 ++++++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/gi/pygi-closure.c b/gi/pygi-closure.c
index 1cc2ec0..17b283f 100644
--- a/gi/pygi-closure.c
+++ b/gi/pygi-closure.c
@@ -274,6 +274,9 @@ _pygi_closure_convert_ffi_arguments (PyGIInvokeArgState *state,
                 }
                 break;
             }
+            case GI_TYPE_TAG_UNICHAR:
+                state[i].arg_value.v_uint32 = * (guint32 *) args[i];
+                break;
             case GI_TYPE_TAG_ERROR:
             case GI_TYPE_TAG_GHASH:
             case GI_TYPE_TAG_GLIST:
diff --git a/tests/test_overrides_gtk.py b/tests/test_overrides_gtk.py
index 86cfda4..a683b70 100644
--- a/tests/test_overrides_gtk.py
+++ b/tests/test_overrides_gtk.py
@@ -1934,6 +1934,20 @@ class TestTextBuffer(unittest.TestCase):
         self.assertEqual(buffer.get_property('text'),
                          'first line\nsecond line\n')
 
+    def test_backward_find_char(self):
+        buffer = Gtk.TextBuffer()
+        buffer.set_text('abc')
+        end = buffer.get_iter_at_line(99)
+
+        values = []
+
+        def pred_func(ch, user_data):
+            values.append(ch)
+            return ch == u"a"
+
+        self.assertTrue(end.backward_find_char(pred_func))
+        self.assertEqual(values, [u"c", u"b", u"a"])
+
 
 @unittest.skipUnless(Gtk, 'Gtk not available')
 class TestContainer(unittest.TestCase):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]