Create unit test for function QEasingCuver.setCustomType.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Hugo Parente Lima <hugo.pl@gmail.com>
This commit is contained in:
parent
cceea0af84
commit
5e778d0f1b
2 changed files with 27 additions and 0 deletions
|
|
@ -40,6 +40,7 @@ PYSIDE_TEST(qcoreapplication_instance_test.py)
|
||||||
PYSIDE_TEST(qdatastream_test.py)
|
PYSIDE_TEST(qdatastream_test.py)
|
||||||
PYSIDE_TEST(qdatetime_test.py)
|
PYSIDE_TEST(qdatetime_test.py)
|
||||||
PYSIDE_TEST(qdate_test.py)
|
PYSIDE_TEST(qdate_test.py)
|
||||||
|
PYSIDE_TEST(qeasingcurve_test.py)
|
||||||
PYSIDE_TEST(qenum_test.py)
|
PYSIDE_TEST(qenum_test.py)
|
||||||
PYSIDE_TEST(qevent_test.py)
|
PYSIDE_TEST(qevent_test.py)
|
||||||
PYSIDE_TEST(qfileinfo_test.py)
|
PYSIDE_TEST(qfileinfo_test.py)
|
||||||
|
|
|
||||||
26
tests/QtCore/qeasingcurve_test.py
Normal file
26
tests/QtCore/qeasingcurve_test.py
Normal file
|
|
@ -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()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue