aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2010-03-15 10:17:12 -0400
committerMarcelo Lira <marcelo.lira@openbossa.org>2010-03-19 15:59:34 -0300
commit1356f832ae7a51435e904218014261072099d3c2 (patch)
treeb92f9ac7a1d360595d9d9e7959d91d863b64b39b /tests
parentff3f3a9cf2efc3e51de83831ffba355abe61e701 (diff)
Fixes QPixmap.loadFromData method and extends QPixmap test cases.
Reviewed by Hugo Parente <hugo.lima@openbossa.org> Reviewed by Bruno Araújo <bruno.araujo@openbossa.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/qtgui/qpixmap_test.py16
-rw-r--r--tests/qtgui/sample.pngbin0 -> 55944 bytes
2 files changed, 15 insertions, 1 deletions
diff --git a/tests/qtgui/qpixmap_test.py b/tests/qtgui/qpixmap_test.py
index bc287f369..64264109b 100644
--- a/tests/qtgui/qpixmap_test.py
+++ b/tests/qtgui/qpixmap_test.py
@@ -1,5 +1,6 @@
import unittest
+import os
from helper import UsesQApplication
from PySide.QtGui import *
from PySide.QtCore import *
@@ -17,12 +18,25 @@ class QPixmapTest(UsesQApplication):
def testQStringConstructor(self):
pixmap = QPixmap(QString("Testing!"))
- def testQVariantConstructor(self):
+ def testQVariantConstructor2(self):
v = QVariant(QPixmap())
pixmap2 = QPixmap(v)
v = QVariant(QImage())
pixmap2 = QPixmap(v)
+ def testQPixmapLoadFromDataWithQFile(self):
+ f = QFile(os.path.join(os.path.dirname(__file__), 'sample.png'))
+ self.assert_(f.open(QIODevice.ReadOnly))
+ data = f.read(f.size())
+ f.close()
+ pixmap = QPixmap()
+ self.assert_(pixmap.loadFromData(data))
+
+ def testQPixmapLoadFromDataWithPython(self):
+ data = open(os.path.join(os.path.dirname(__file__),'sample.png'),'rb').read()
+ pixmap = QPixmap()
+ self.assert_(pixmap.loadFromData(data))
+
if __name__ == '__main__':
unittest.main()
diff --git a/tests/qtgui/sample.png b/tests/qtgui/sample.png
new file mode 100644
index 000000000..60450f0dc
--- /dev/null
+++ b/tests/qtgui/sample.png
Binary files differ