Added all original pyside unit tests to the shiboken version.
This commit is contained in:
parent
aa12538d63
commit
9af36fbb64
160 changed files with 6616 additions and 12 deletions
46
tests/qtgui/qlabel_pixmap_refcount.py
Normal file
46
tests/qtgui/qlabel_pixmap_refcount.py
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
|
||||
'''Test cases for QLabel->pixmap refcount control'''
|
||||
|
||||
import unittest
|
||||
import sys
|
||||
|
||||
|
||||
from helper import UsesQApplication
|
||||
from PySide.QtGui import QApplication, QLabel, QPixmap
|
||||
|
||||
class QLabelTest(UsesQApplication):
|
||||
'''Test case for constructor of QBrush'''
|
||||
|
||||
def testDestroyOwner(self):
|
||||
p = QPixmap()
|
||||
l = QLabel()
|
||||
l.setPixmap(p)
|
||||
|
||||
del p
|
||||
|
||||
p1 = l.pixmap()
|
||||
self.assertEqual(sys.getrefcount(p1), 2)
|
||||
self.assertEqual(sys.getrefcount(l), 2)
|
||||
|
||||
del l
|
||||
self.assertEqual(sys.getrefcount(p1), 2)
|
||||
|
||||
|
||||
def testRefCount(self):
|
||||
p = QPixmap()
|
||||
l = QLabel()
|
||||
l.setPixmap(p)
|
||||
|
||||
del p
|
||||
|
||||
p1 = l.pixmap()
|
||||
self.assertEqual(sys.getrefcount(p1), 2)
|
||||
|
||||
p2 = l.pixmap()
|
||||
self.assertEqual(sys.getrefcount(p2), 3)
|
||||
|
||||
p3 = l.pixmap()
|
||||
self.assertEqual(sys.getrefcount(p3), 4)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue