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
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