Exit cleanly when the user clicks the window's X. No-op on headless runs (no pygame display initialized).
(env)
| 121 | |
| 122 | |
| 123 | def quit_if_window_closed(env): |
| 124 | """Exit cleanly when the user clicks the window's X. |
| 125 | |
| 126 | No-op on headless runs (no pygame display initialized). |
| 127 | """ |
| 128 | if not pygame.display.get_init(): |
| 129 | return |
| 130 | for event in pygame.event.get(): |
| 131 | if event.type == pygame.QUIT: |
| 132 | env.close() |
| 133 | sys.exit() |
| 134 | |
| 135 | |
| 136 | def run_test_loop(env, get_action): |
no outgoing calls
no test coverage detected