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
1
tests/QtSvg/CMakeLists.txt
Normal file
1
tests/QtSvg/CMakeLists.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
PYSIDE_TEST(qsvggenerator_test.py)
|
||||
34
tests/QtSvg/qsvggenerator_test.py
Normal file
34
tests/QtSvg/qsvggenerator_test.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/python
|
||||
import unittest
|
||||
from sys import getrefcount
|
||||
from PySide.QtCore import QBuffer
|
||||
from PySide.QtSvg import QSvgGenerator
|
||||
|
||||
class QSvgGeneratorTest(unittest.TestCase):
|
||||
|
||||
def testRefCountOfTOutputDevice(self):
|
||||
generator = QSvgGenerator()
|
||||
iodevice1 = QBuffer()
|
||||
refcount1 = getrefcount(iodevice1)
|
||||
|
||||
generator.setOutputDevice(iodevice1)
|
||||
|
||||
self.assertEqual(generator.outputDevice(), iodevice1)
|
||||
self.assertEqual(getrefcount(generator.outputDevice()), refcount1 + 1)
|
||||
|
||||
iodevice2 = QBuffer()
|
||||
refcount2 = getrefcount(iodevice2)
|
||||
|
||||
generator.setOutputDevice(iodevice2)
|
||||
|
||||
self.assertEqual(generator.outputDevice(), iodevice2)
|
||||
self.assertEqual(getrefcount(generator.outputDevice()), refcount2 + 1)
|
||||
self.assertEqual(getrefcount(iodevice1), refcount1)
|
||||
|
||||
del generator
|
||||
|
||||
self.assertEqual(getrefcount(iodevice2), refcount2)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue