예제 #1
0
파일: world_test.py 프로젝트: deavid/grease
 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)
예제 #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)
예제 #3
0
파일: world_test.py 프로젝트: deavid/grease
 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)
예제 #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)