test_3d_scene.py 458 B

12345678910111213141516
  1. from nicegui import ui
  2. from .user import User
  3. def test_moving_sphere_with_timer(user: User):
  4. with ui.scene() as scene:
  5. sphere = scene.sphere().move(0, -5, 2)
  6. ui.timer(0.03, lambda: sphere.move(sphere.x, sphere.y + 0.05, sphere.z))
  7. user.open('/')
  8. user.sleep(0.1)
  9. def position(): return user.selenium.execute_script('return scene.children[4].position.y')
  10. pos = position()
  11. user.sleep(0.1)
  12. assert position() > pos