summaryrefslogtreecommitdiff
path: root/tests/ecore/test_04_idler.py
diff options
context:
space:
mode:
authordavemds <dave@gurumeditation.it>2013-05-13 01:29:44 +0200
committerdavemds <dave@gurumeditation.it>2013-05-13 01:29:44 +0200
commit236d66caf8d14e8e22f8211d94430f880f944e24 (patch)
treee0b39003e8a40984397d13e4d9df27aedcbf73d7 /tests/ecore/test_04_idler.py
parent1c255024d3bcf0f95cf93c067c976f9139d11ef9 (diff)
Python-EFL: rename examples, just to keep them ordered
Diffstat (limited to 'tests/ecore/test_04_idler.py')
-rw-r--r--tests/ecore/test_04_idler.py49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/ecore/test_04_idler.py b/tests/ecore/test_04_idler.py
new file mode 100644
index 0000000..895516e
--- /dev/null
+++ b/tests/ecore/test_04_idler.py
@@ -0,0 +1,49 @@
1#!/usr/bin/env python
2
3from efl import ecore
4import unittest
5
6
7def cb_true(n, t, a):
8 print("cb_true: %s %s %s" % (n, t, a))
9 return True
10
11def cb_false(n, t, a):
12 print("cb_false: %s %s %s" % (n, t, a))
13 return False
14
15
16class TestIdler(unittest.TestCase):
17 def testInit(self):
18 i1 = ecore.idler_add(cb_true, 123, "teste", a=456)
19 i2 = ecore.Idler(cb_false, 789, "bla", a="something in a")
20
21 self.assertIsInstance(i1, ecore.Idler)
22 self.assertIsInstance(i2, ecore.Idler)
23
24 before1 = i1.__repr__()
25 before2 = i2.__repr__()
26
27 t = ecore.timer_add(1, ecore.main_loop_quit)
28 ecore.main_loop_begin()
29
30 after1 = i1.__repr__()
31 after2 = i2.__repr__()
32
33 self.assertEqual(before1, after1)
34 self.assertNotEqual(before2, after2) # already deleted
35
36 self.assertEqual(t.is_deleted(), True)
37 self.assertEqual(i1.is_deleted(), False)
38 self.assertEqual(i2.is_deleted(), True)
39
40
41 i1.delete()
42 del t
43 del i1
44 del i2 # already deleted since returned false
45
46
47if __name__ == '__main__':
48 unittest.main(verbosity=2)
49 ecore.shutdown()