aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--PySide/QtGui/typesystem_gui_common.xml15
-rw-r--r--tests/QtGui/qimage_test.py11
2 files changed, 24 insertions, 2 deletions
diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml
index a0b84fc70..70535e664 100644
--- a/PySide/QtGui/typesystem_gui_common.xml
+++ b/PySide/QtGui/typesystem_gui_common.xml
@@ -803,6 +803,21 @@
</inject-code>
</modify-function>
+ <add-function signature="QImage(QString,int,int,int,QImage::Format)">
+ <inject-code>
+ <insert-template name="qimage_buffer_constructor">
+ <replace from="%ARGS" to="%2, %3, %4, %5" />
+ </insert-template>
+ </inject-code>
+ </add-function>
+ <add-function signature="QImage(QString,int,int,QImage::Format)">
+ <inject-code>
+ <insert-template name="qimage_buffer_constructor">
+ <replace from="%ARGS" to="%2, %3, %4" />
+ </insert-template>
+ </inject-code>
+ </add-function>
+
<!-- The non-const versions are already used -->
<modify-function signature="QImage(const uchar*,int,int,int,QImage::Format)" remove="all"/>
<modify-function signature="QImage(const uchar*,int,int,QImage::Format)" remove="all" />
diff --git a/tests/QtGui/qimage_test.py b/tests/QtGui/qimage_test.py
index e9af2d71d..b1a302676 100644
--- a/tests/QtGui/qimage_test.py
+++ b/tests/QtGui/qimage_test.py
@@ -2,8 +2,8 @@
'''Test cases for QImage'''
import unittest
-from PySide.QtGui import *
-from helper import *
+from PySide.QtGui import QImage
+from helper import UsesQApplication, adjust_filename
class QImageTest(UsesQApplication):
'''Test case for calling setPixel with float as argument'''
@@ -27,6 +27,13 @@ class QImageTest(UsesQApplication):
self.assertEquals(str(data1), img0.bits()[:img0.bytesPerLine()])
self.assertEquals(str(data2), img0.bits()[:img0.bytesPerLine()])
+ def testEmptyBuffer(self):
+ img = QImage(buffer(''), 100, 100, QImage.Format_ARGB32)
+
+ def testEmptyStringAsBuffer(self):
+ img = QImage('', 100, 100, QImage.Format_ARGB32)
+
+
if __name__ == '__main__':
unittest.main()