Created unit test for function QPicture.setData
Reviewer: Lauro Moura <lauro.neto@openbossa.org>
Hugo Parente Lima <hugo.pl@gmail.com>
This commit is contained in:
parent
fc47ed069e
commit
c9a260df4b
2 changed files with 36 additions and 0 deletions
|
|
@ -97,6 +97,7 @@ PYSIDE_TEST(qmenu_test.py)
|
||||||
PYSIDE_TEST(qobject_mi_test.py)
|
PYSIDE_TEST(qobject_mi_test.py)
|
||||||
PYSIDE_TEST(qpainter_test.py)
|
PYSIDE_TEST(qpainter_test.py)
|
||||||
PYSIDE_TEST(qpen_test.py)
|
PYSIDE_TEST(qpen_test.py)
|
||||||
|
PYSIDE_TEST(qpicture_test.py)
|
||||||
PYSIDE_TEST(qpixmap_test.py)
|
PYSIDE_TEST(qpixmap_test.py)
|
||||||
PYSIDE_TEST(qpixmap_constructor.py)
|
PYSIDE_TEST(qpixmap_constructor.py)
|
||||||
PYSIDE_TEST(qpolygonf_test.py)
|
PYSIDE_TEST(qpolygonf_test.py)
|
||||||
|
|
|
||||||
35
tests/QtGui/qpicture_test.py
Normal file
35
tests/QtGui/qpicture_test.py
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
import os
|
||||||
|
from helper import UsesQApplication
|
||||||
|
from PySide.QtGui import QPicture, QPainter, QWidget
|
||||||
|
|
||||||
|
class MyWidget(QWidget):
|
||||||
|
def paintEvent(self, e):
|
||||||
|
p = QPainter(self)
|
||||||
|
p.drawPicture(0, 0, self._picture)
|
||||||
|
self._app.quit()
|
||||||
|
|
||||||
|
class QPictureTest(UsesQApplication):
|
||||||
|
def testFromData(self):
|
||||||
|
picture = QPicture()
|
||||||
|
painter = QPainter()
|
||||||
|
painter.begin(picture)
|
||||||
|
painter.drawEllipse(10,20, 80,70)
|
||||||
|
painter.end()
|
||||||
|
|
||||||
|
data = picture.data()
|
||||||
|
picture2 = QPicture()
|
||||||
|
picture2.setData(data)
|
||||||
|
|
||||||
|
self.assertEqual(picture2.data(), picture.data())
|
||||||
|
|
||||||
|
w = MyWidget()
|
||||||
|
w._picture = picture2
|
||||||
|
w._app = self.app
|
||||||
|
w.show()
|
||||||
|
self.app.exec_()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue