Created new unittest model.
Separete unittest for module.
Only run unittest for compiled modules.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>,
Luciano Wolf <luciano.wolf@openbossa.org>
This commit is contained in:
parent
471486732b
commit
ab918abc1e
211 changed files with 241 additions and 79 deletions
32
tests/QtGui/qtextedit_test.py
Normal file
32
tests/QtGui/qtextedit_test.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
'''Test cases for QTextEdit and ownership problems.'''
|
||||
|
||||
import unittest
|
||||
from sys import getrefcount
|
||||
from PySide.QtGui import QTextEdit
|
||||
|
||||
from helper import UsesQApplication
|
||||
|
||||
class DontTouchReference(UsesQApplication):
|
||||
'''Check if the QTextTable returned by QTextCursor.insertTable() is not
|
||||
referenced by the QTextCursor that returns it.'''
|
||||
|
||||
def setUp(self):
|
||||
super(DontTouchReference, self).setUp()
|
||||
self.editor = QTextEdit()
|
||||
self.cursor = self.editor.textCursor()
|
||||
self.table = self.cursor.insertTable(1, 1)
|
||||
|
||||
def testQTextTable(self):
|
||||
# methods which return QTextTable should not increment its reference
|
||||
self.assertEqual(getrefcount(self.table), 2)
|
||||
f = self.cursor.currentFrame()
|
||||
del f
|
||||
self.assertEqual(getrefcount(self.table), 2)
|
||||
# destroying the cursor should not raise any "RuntimeError: internal
|
||||
# C++ object already deleted." when accessing the QTextTable
|
||||
del self.cursor
|
||||
self.assertEqual(getrefcount(self.table), 2)
|
||||
cell = self.table.cellAt(0, 0)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue