comparison tests/swig_tests/eventchannel_tests.py @ 0:4a0efb7baf70

* Datasets becomes the new trunk and retires after that :-)
author mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
date Sun, 29 Jun 2008 18:44:17 +0000
parents
children d2f1e81fbe2c
comparison
equal deleted inserted replaced
-1:000000000000 0:4a0efb7baf70
1 #!/usr/bin/env python
2 from swig_test_utils import *
3
4 class MyEventListener(fife.ICommandListener):
5 def __init__(self):
6 fife.ICommandListener.__init__(self)
7
8 def onCommand(self, command):
9 print "received command with code %d" % command.getCode()
10
11 class TestEventChannel(unittest.TestCase):
12
13 def setUp(self):
14 self.engine = getEngine(True)
15 self.eventmanager = self.engine.getEventManager()
16
17 def tearDown(self):
18 del self.engine
19
20 def testEvents(self):
21 l = MyEventListener()
22 self.eventmanager.addCommandListener(l)
23 cmd = fife.Command()
24 cmd.setCode(0)
25 print "Sending commands..."
26 for i in xrange(20):
27 self.eventmanager.dispatchCommand(cmd)
28 cmd.setCode(i)
29 self.eventmanager.removeCommandListener(l)
30
31 TEST_CLASSES = [TestEventChannel]
32
33 if __name__ == '__main__':
34 unittest.main()