summaryrefslogtreecommitdiff
path: root/tests/gimarshallingtestsextra.h
Commit message (Collapse)AuthorAgeFilesLines
* gimarshallingtestsextra.c/h: relicense to LGPLv2.1+. Fixes #320Christoph Reiter2019-04-121-8/+8
| | | | | | | | These files had contributions from Thibault Saunier, Aurelien Jarno, Mathieu Duponchelle and me. All agreed to provide their contribution under the LGPLv2.1+, see #320 for details. This makes the file licenses match the project license.
* Add meson build definitionsMathieu Duponchelle2018-04-201-0/+13
|
* tests: add tests for functions returning invalid utf-8. See #171Christoph Reiter2018-03-191-0/+3
| | | | | I can't reproduce the error here, so I'm probably missing something. Having this tested is a good idea either way.
* flags: Add testcase for bug 786948Christoph Reiter2017-10-241-0/+11
| | | | | | | | Add a flags type which has a value with the highes bit set and fits in an int. While the C type is a signed int, the type is registered as flags, which GI interprets as unsigned. https://bugzilla.gnome.org/show_bug.cgi?id=786948
* to_py_array: Properly handle enum array itemsChristoph Reiter2017-10-221-0/+2
| | | | | | | It used the fallback path and copied pointers. Do the same thing we do for integer items instead. https://bugzilla.gnome.org/show_bug.cgi?id=788890
* Add support for bytes and non-utf-8 file names.Christoph Reiter2017-03-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Py2+Unix: Convert unicode to bytes using the fsencoding. Pass bytes as is. Returns path as bytes as is. Py2+Windows: Convert unicode to wtf-8. Pass bytes as is. Returns path as bytes as is. Py3+Unix: Convert str using os.fsencode so that the surrogateescape handler can restore the real path if the source was a Python API such as os.listdir sys.argv etc. Pass bytes as is. Return str decoded using os.fsdecode so that it can be passed to Python API such as open, os.listdir etc. Py3+Windows: Convert str to wtf-8. Decode bytes using the fsencoding first. Returns str + surrogates. This change makes anyting taking filenames on Python 3 behave the same as Python functions like listdir() or open(). Compared to Python 3 builtin functions which return the same type that was passed in we always return str. One remaining problem is that glib assumes that Windows paths are utf-16, while they are just 16bit arrays and as a result utf-8 is not enough to represent all possible paths. We use wtf-8 here instead (utf-8 with lone surrogates), which allows us to convert all paths, but glib functions accessing the fs will fail with them. PyUnicode_EncodeFSDefault was added in CPython 3.2 so bump the requirement. https://bugzilla.gnome.org/show_bug.cgi?id=746564
* Handle nullable filename parametersChristoph Reiter2016-09-031-0/+3
| | | | | | | | | | | Make _pygi_marshal_from_py_filename handle None input values. This allows one to pass None to parameters annotated as nullable filenames. This fixes a test suite error in test_spawn_async_with_pipes triggered by an annotation change in glib. https://bugzilla.gnome.org/show_bug.cgi?id=770821
* Fix list/hashtable enum <-> hash conversion on 64-bit big endianAurelien Jarno2016-09-031-0/+10
| | | | | | | | | | | | | | | | | | | | | | glist and ghashtable objects both store pointers. Complex objects are stored as pointers to the objects, but simpler objects like an integer value are stored directly as a pointer, using for example the GINT_TO_POINTER and GPOINTER_TO_INT macros. This is done in pygobject with the _pygi_hash_pointer_to_arg and _pygi_arg_to_hash_pointer functions. These functions handle the various type of objects. However they consider that an enum, represented with the GI_TYPE_TAG_INTERFACE type (extended interface object), are always a pointer. This is wrong as it is often a 32-bit value. Therefore on 64-bit big endian machines, the value is handle with the 2 32-bit parts swapped. This patches fixes that by changing the second argument of both functions from GITypeTag to GITypeInfo. This way the interface can be determined, and the underlying storage type can also be determined. This currently only handles enum and flags, leaving other types as pointers. The patch also adds two tests in the testsuite, one for each direction. https://bugzilla.gnome.org/show_bug.cgi?id=770608
* tests: check passing Boxed type in GValue as function parametersThibault Saunier2016-03-011-0/+26
https://bugzilla.gnome.org/show_bug.cgi?id=761592