Beispiel #1
0
 def test_tick_increments_world_time(self):
     from grease import World
     world = World(clock_factory=TestClock)
     self.assertEqual(world.time, 0)
     self.assertEqual(world.clock.ticks, 0)
     self.assertEqual(world.clock.time_func(), world.time)
     dt = 1.0/30.0
     world.tick(dt)
     self.assertAlmostEqual(world.time, dt)
     self.assertEqual(world.clock.time_func(), world.time)
     self.assertEqual(world.clock.ticks, 1)
     world.tick(dt)
     self.assertAlmostEqual(world.time, dt*2)
     self.assertEqual(world.clock.time_func(), world.time)
     self.assertEqual(world.clock.ticks, 2)
Beispiel #2
0
 def test_tick_increments_world_time(self):
     from grease import World
     world = World(clock_factory=TestClock)
     self.assertEqual(world.time, 0)
     self.assertEqual(world.clock.ticks, 0)
     self.assertEqual(world.clock.time_func(), world.time)
     dt = 1.0 / 30.0
     world.tick(dt)
     self.assertAlmostEqual(world.time, dt)
     self.assertEqual(world.clock.time_func(), world.time)
     self.assertEqual(world.clock.ticks, 1)
     world.tick(dt)
     self.assertAlmostEqual(world.time, dt * 2)
     self.assertEqual(world.clock.time_func(), world.time)
     self.assertEqual(world.clock.ticks, 2)
Beispiel #3
0
 def test_running(self):
     from grease import World
     world = World()
     self.assertTrue(world.running)
     self.assertEqual(world.time, 0)
     dt = 1.0/30.0
     world.tick(dt)
     self.assertAlmostEqual(world.time, dt)
     world.running = False
     world.tick(dt)
     world.tick(dt)
     self.assertAlmostEqual(world.time, dt)
     world.running = True
     world.tick(dt)
     self.assertAlmostEqual(world.time, dt*2)
Beispiel #4
0
 def test_running(self):
     from grease import World
     world = World()
     self.assertTrue(world.running)
     self.assertEqual(world.time, 0)
     dt = 1.0 / 30.0
     world.tick(dt)
     self.assertAlmostEqual(world.time, dt)
     world.running = False
     world.tick(dt)
     world.tick(dt)
     self.assertAlmostEqual(world.time, dt)
     world.running = True
     world.tick(dt)
     self.assertAlmostEqual(world.time, dt * 2)