Mercurial > fife-parpg
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/swig_tests/eventchannel_tests.py Sun Jun 29 18:44:17 2008 +0000 @@ -0,0 +1,34 @@ +#!/usr/bin/env python +from swig_test_utils import * + +class MyEventListener(fife.ICommandListener): + def __init__(self): + fife.ICommandListener.__init__(self) + + def onCommand(self, command): + print "received command with code %d" % command.getCode() + +class TestEventChannel(unittest.TestCase): + + def setUp(self): + self.engine = getEngine(True) + self.eventmanager = self.engine.getEventManager() + + def tearDown(self): + del self.engine + + def testEvents(self): + l = MyEventListener() + self.eventmanager.addCommandListener(l) + cmd = fife.Command() + cmd.setCode(0) + print "Sending commands..." + for i in xrange(20): + self.eventmanager.dispatchCommand(cmd) + cmd.setCode(i) + self.eventmanager.removeCommandListener(l) + +TEST_CLASSES = [TestEventChannel] + +if __name__ == '__main__': + unittest.main()