Bug 1350 - Simulator.ScheduleWithContext Python binding missing

This commit is contained in:
alina & Gustavo Carneiro
2012-02-14 17:45:50 +00:00
parent cd2952dcea
commit a320abac57
3 changed files with 96 additions and 5 deletions

View File

@@ -49,6 +49,21 @@ class TestSimulator(unittest.TestCase):
self.assertEqual(self._args_received, "args")
self.assertEqual(self._cb_time.GetSeconds(), 123.0)
def testScheduleWithContext(self):
def callback(context, args):
self._context_received = context
self._args_received = args
self._cb_time = Simulator.Now()
Simulator.Destroy()
self._args_received = None
self._cb_time = None
self._context_received = None
Simulator.ScheduleWithContext(54321, Seconds(123), callback, "args")
Simulator.Run()
self.assertEqual(self._context_received, 54321)
self.assertEqual(self._args_received, "args")
self.assertEqual(self._cb_time.GetSeconds(), 123.0)
def testTimeComparison(self):
self.assert_(Seconds(123) == Seconds(123))
self.assert_(Seconds(123) >= Seconds(123))