summaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--tests/QtCore/CMakeLists.txt1
-rw-r--r--tests/QtCore/qeasingcurve_test.py26
2 files changed, 27 insertions, 0 deletions
diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt
index c0829f4..cd9efca 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 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()