[pygobject: 1/2] pygi-info: wrap g_union_info_get_alignment()



commit 05a59a1cdf8774eb351ea7ede186c5be0480d4f7
Author: Tomasz Miąsko <tomasz miasko gmail com>
Date:   Fri Dec 14 00:00:00 2018 +0000

    pygi-info: wrap g_union_info_get_alignment()
    
    Aligment is useful when validating ABI against C.
    It is already wrapped for structs, wrap it for unions as well.

 gi/pygi-info.c           | 7 +++++++
 tests/test_repository.py | 1 +
 2 files changed, 8 insertions(+)
---
diff --git a/gi/pygi-info.c b/gi/pygi-info.c
index 4fca825a..904b866f 100644
--- a/gi/pygi-info.c
+++ b/gi/pygi-info.c
@@ -2229,10 +2229,17 @@ _wrap_g_union_info_get_size (PyGIBaseInfo *self)
     return pygi_gsize_to_py (g_union_info_get_size (self->info));
 }
 
+static PyObject *
+_wrap_g_union_info_get_alignment (PyGIBaseInfo *self)
+{
+    return pygi_gsize_to_py (g_union_info_get_alignment (self->info));
+}
+
 static PyMethodDef _PyGIUnionInfo_methods[] = {
     { "get_fields", (PyCFunction) _wrap_g_union_info_get_fields, METH_NOARGS },
     { "get_methods", (PyCFunction) _wrap_g_union_info_get_methods, METH_NOARGS },
     { "get_size", (PyCFunction) _wrap_g_union_info_get_size, METH_NOARGS },
+    { "get_alignment", (PyCFunction) _wrap_g_union_info_get_alignment, METH_NOARGS },
     { NULL, NULL, 0 }
 };
 
diff --git a/tests/test_repository.py b/tests/test_repository.py
index de2e5c95..9be79486 100644
--- a/tests/test_repository.py
+++ b/tests/test_repository.py
@@ -203,6 +203,7 @@ class Test(unittest.TestCase):
         self.assertTrue(isinstance(info.get_fields(), abc.Iterable))
         self.assertTrue(isinstance(info.get_methods(), abc.Iterable))
         self.assertTrue(isinstance(info.get_size(), int))
+        self.assertTrue(isinstance(info.get_alignment(), int))
 
     def test_type_info(self):
         func_info = repo.find_by_name('GIMarshallingTests', 'array_fixed_out_struct')


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