diff options
author | Renato Filho <renato.filho@openbossa.org> | 2011-05-18 15:32:11 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:54:24 -0300 |
commit | 5e778d0f1b39993fa3eb5976c950caf6e5f4eb85 (patch) | |
tree | 587a43fb221584cc044dac20d9314511f59b41e4 /tests/QtCore | |
parent | cceea0af845bd17149ff01a6d01c6c9b1453e230 (diff) |
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')
-rw-r--r-- | tests/QtCore/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/QtCore/qeasingcurve_test.py | 26 |
2 files changed, 27 insertions, 0 deletions
diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt index c0829f4d2..cd9efca0e 100644 --- a/tests/QtCore/CMakeLists.txt +++ b/tests/QtCore/CMakeLists.txt @@ -40,6 +40,7 @@ PYSIDE_TEST(qcoreapplication_instance_test.py) PYSIDE_TEST(qdatastream_test.py) PYSIDE_TEST(qdatetime_test.py) PYSIDE_TEST(qdate_test.py) +PYSIDE_TEST(qeasingcurve_test.py) PYSIDE_TEST(qenum_test.py) PYSIDE_TEST(qevent_test.py) PYSIDE_TEST(qfileinfo_test.py) diff --git a/tests/QtCore/qeasingcurve_test.py b/tests/QtCore/qeasingcurve_test.py new file mode 100644 index 000000000..77c0e6c6d --- /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() |