aboutsummaryrefslogtreecommitdiffstats
path: root/tests/QtSvg
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-06-07 14:43:45 -0300
committerRenato Filho <renato.filho@openbossa.org>2010-06-07 16:57:11 -0300
commitab918abc1e103e0ca86939f7d057e8a44ac8a4ef (patch)
tree53c6f57d089dcf5e145d766b1ceef704714046d8 /tests/QtSvg
parent471486732b03cbb42b884158604a59d5a18e8a35 (diff)
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>
Diffstat (limited to 'tests/QtSvg')
-rw-r--r--tests/QtSvg/CMakeLists.txt1
-rw-r--r--tests/QtSvg/qsvggenerator_test.py34
2 files changed, 35 insertions, 0 deletions
diff --git a/tests/QtSvg/CMakeLists.txt b/tests/QtSvg/CMakeLists.txt
new file mode 100644
index 000000000..6a9c9d562
--- /dev/null
+++ b/tests/QtSvg/CMakeLists.txt
@@ -0,0 +1 @@
+PYSIDE_TEST(qsvggenerator_test.py)
diff --git a/tests/QtSvg/qsvggenerator_test.py b/tests/QtSvg/qsvggenerator_test.py
new file mode 100644
index 000000000..cec7fdaff
--- /dev/null
+++ b/tests/QtSvg/qsvggenerator_test.py
@@ -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()
+