Branch and push for 2.0
[profile/ivi/pygobject2.git] / tests / test_thread.py
1 # -*- Mode: Python -*-
2
3 import unittest
4
5 import glib
6 import testhelper
7
8
9 class TestThread(unittest.TestCase):
10     def setUp(self):
11         self.main = glib.MainLoop()
12
13     def from_thread_cb(self, test, enum):
14         assert test == self.obj
15         assert int(enum) == 0
16         assert type(enum) != int
17
18     def idle_cb(self):
19         self.obj = testhelper.get_test_thread()
20         self.obj.connect('from-thread', self.from_thread_cb)
21         self.obj.emit('emit-signal')
22
23     def testExtensionModule(self):
24         glib.idle_add(self.idle_cb)
25         glib.timeout_add(50, self.timeout_cb)
26         self.main.run()
27
28     def timeout_cb(self):
29         self.main.quit()