aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2
diff options
context:
space:
mode:
authorBoxiang Sun <daetalusun@gmail.com>2018-04-28 09:53:49 +0800
committerBoxiang Sun <daetalusun@gmail.com>2018-06-01 13:15:17 +0000
commitddbd93680730811a5020b4d429c2e3e11d6823e3 (patch)
tree4a273068d222560b2414f903faf35762802abede /sources/pyside2
parent807183092b19b5df07a0630a78ebe534ba38a7b2 (diff)
Improve sbkstring::toCString to support unicode
If `unicode` is used in Python 2, shiboken cannot properly translate it to `const char *`. sbkstring did not supported a proper conversion of unicode types in Python2, and this change includes it. Task-number: PYSIDE-100 Change-Id: I3a70d935ad61b0e567e620c62754800370270a6b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/pyside2')
-rw-r--r--sources/pyside2/tests/QtCore/unicode_test.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/sources/pyside2/tests/QtCore/unicode_test.py b/sources/pyside2/tests/QtCore/unicode_test.py
index 3326e2e0e..f44a00c62 100644
--- a/sources/pyside2/tests/QtCore/unicode_test.py
+++ b/sources/pyside2/tests/QtCore/unicode_test.py
@@ -35,6 +35,7 @@ import unittest
import py3kcompat as py3k
from PySide2.QtCore import QObject
+from PySide2.QtCore import QByteArray
class UnicodeConversion(unittest.TestCase):
'''Test case for QString to/from Python Unicode conversion'''
@@ -57,6 +58,10 @@ class UnicodeConversion(unittest.TestCase):
obj.setObjectName(py3k.unicode_('ümlaut'))
self.assertEqual(obj.objectName(), py3k.unicode_('ümlaut'))
+ def testTranslateUnicode(self):
+ ba = QByteArray(py3k.unicode_('0123456789'))
+ self.assertEqual(ba.__str__(), py3k.unicode_('0123456789'))
+
if __name__ == '__main__':
unittest.main()