summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2010-12-30 16:36:23 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:48:06 -0300
commit9e6762eeb050496f74fdafa1325dd294bf564ce1 (patch)
tree89dd6c04c629ba52f4c9d31c2eb71718c2ed0323
parent394cdb357d88e4c6968d3986ca7820756661fa35 (diff)
Fix bug#514 - "Static method QByteArray.fromRawData is missing from QtCore"
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Lauro Moura <lauro.neto@openbossa.org>
-rw-r--r--PySide/QtCore/typesystem_core.xml10
-rw-r--r--tests/QtCore/qbytearray_test.py7
2 files changed, 16 insertions, 1 deletions
diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml
index e416e575..c785f797 100644
--- a/PySide/QtCore/typesystem_core.xml
+++ b/PySide/QtCore/typesystem_core.xml
@@ -1734,7 +1734,15 @@
<modify-argument index="0" replace-value="this"/>
</modify-function>
<modify-function signature="startsWith(const char *)const" remove="all"/>
- <modify-function signature="fromRawData(const char*,int)" remove="all"/>
+ <modify-function signature="fromRawData(const char*,int)">
+ <modify-argument index="2">
+ <remove-argument />
+ </modify-argument>
+ <inject-code class="target">
+ // %FUNCTION_NAME() - avoid generation of default function call
+ %PYARG_0 = %CONVERTTOPYTHON[QByteArray](QByteArray(%1));
+ </inject-code>
+ </modify-function>
<modify-function signature="number(int,int)">
<rename to="fromInt"/>
</modify-function>
diff --git a/tests/QtCore/qbytearray_test.py b/tests/QtCore/qbytearray_test.py
index 2c0ee87c..34dc42f5 100644
--- a/tests/QtCore/qbytearray_test.py
+++ b/tests/QtCore/qbytearray_test.py
@@ -102,5 +102,12 @@ class QByteArrayOnQVariant(unittest.TestCase):
a = QSettings().value("some_prop", QByteArray())
self.assertEqual(type(a), QByteArray)
+class QByteArrayBug514(unittest.TestCase):
+ def testIt(self):
+ data = "foobar"
+ a = QByteArray.fromRawData(data)
+ self.assertEqual(type(a), QByteArray)
+ self.assertEqual(a.data(), data)
+
if __name__ == '__main__':
unittest.main()