summaryrefslogtreecommitdiffstats
path: root/tests/QtCore/qeasingcurve_test.py
blob: 77c0e6c6d67917262b38c9ee188fb1dac71337b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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()