summaryrefslogtreecommitdiffstats
path: root/tests/QtCore/qeasingcurve_test.py
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-05-18 15:32:11 -0300
committerRenato Filho <renato.filho@openbossa.org>2011-05-19 10:29:59 -0300
commit6e16fd86f41569070f1114711b46db0d7f76f1c9 (patch)
tree90d49ddfe9f8c4ab2ce4780b25a600f3a5255e3c /tests/QtCore/qeasingcurve_test.py
parent40277720ae456b7ef45afb0ceab10e208c352370 (diff)
downloadpyside-6e16fd86f41569070f1114711b46db0d7f76f1c9.tar.gz
pyside-6e16fd86f41569070f1114711b46db0d7f76f1c9.tar.xz
pyside-6e16fd86f41569070f1114711b46db0d7f76f1c9.zip
Create unit test for function QEasingCuver.setCustomType.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Hugo Parente Lima <hugo.pl@gmail.com>
Diffstat (limited to 'tests/QtCore/qeasingcurve_test.py')
-rw-r--r--tests/QtCore/qeasingcurve_test.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/QtCore/qeasingcurve_test.py b/tests/QtCore/qeasingcurve_test.py
new file mode 100644
index 0000000..77c0e6c
--- /dev/null
+++ b/tests/QtCore/qeasingcurve_test.py
@@ -0,0 +1,26 @@
+import unittest
+
+from PySide.QtCore import QEasingCurve
+
+def myFunction(progress):
+ if progress == 1.0:
+ return 100.0
+ else:
+ return -100.0
+
+class TestQEasingCurve(unittest.TestCase):
+ def testCustomType(self):
+ ec = QEasingCurve()
+ ec.setCustomType(myFunction)
+ self.assertEqual(ec.valueForProgress(1.0), 100.0)
+ self.assertEqual(ec.valueForProgress(0.5), -100.0)
+
+ def testObjectCleanup(self):
+ for i in range(100):
+ ec = QEasingCurve()
+ ec.setCustomType(myFunction)
+ self.assertEqual(ec.valueForProgress(1.0), 100.0)
+ self.assertEqual(ec.valueForProgress(0.5), -100.0)
+
+if __name__ == '__main__':
+ unittest.main()