diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2010-11-11 14:04:06 -0200 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2010-11-11 14:16:46 -0200 |
commit | 7013bd760e1ad46b31c019e0a11df504d6e2563e (patch) | |
tree | 133d4942b58deeaae1fcb2057604e72763d75c51 | |
parent | 2a4ee1675dd798d5a50363fb073e6801d45a8d17 (diff) |
Fix bug#455 - "QByteArray.data() cuts data to first '\x00' char"
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Luciano Wolf <luciano.wolf@openbossa.org>
-rw-r--r-- | PySide/QtCore/typesystem_core.xml | 6 | ||||
-rw-r--r-- | tests/QtCore/qbytearray_test.py | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index f5216073f..e542ea693 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -1437,6 +1437,12 @@ #endif </inject-code> + <modify-function signature="data()const"> + <inject-code class="target" position="beginning"> + %PYARG_0 = PyString_FromStringAndSize(%CPPSELF.%FUNCTION_NAME(), %CPPSELF.size()); + </inject-code> + </modify-function> + <!-- removed functions --> <modify-function signature="begin()" remove="all"/> <modify-function signature="begin()const" remove="all"/> diff --git a/tests/QtCore/qbytearray_test.py b/tests/QtCore/qbytearray_test.py index 1c425b8e9..2c0ee87ce 100644 --- a/tests/QtCore/qbytearray_test.py +++ b/tests/QtCore/qbytearray_test.py @@ -42,6 +42,12 @@ class QByteArrayData(unittest.TestCase): url = QByteArray("http://web.openbossa.org/") self.assertEqual(url.data(), "http://web.openbossa.org/") + def testDataWithZeros(self): + s1 = "123\000321" + ba = QByteArray(s1) + s2 = ba.data() + self.assertEqual(s1, s2) + class QByteArrayOperatorAtSetter(unittest.TestCase): '''Test case for operator QByteArray[] - __setitem__''' |