Upload files to "/"
This commit is contained in:
commit
7481a639ad
16 changed files with 1690 additions and 0 deletions
20
tests/test_game.py
Normal file
20
tests/test_game.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import os
|
||||
|
||||
# Use the SDL dummy video driver so tests can run headless in CI
|
||||
os.environ.setdefault("SDL_VIDEODRIVER", "dummy")
|
||||
|
||||
import pygame
|
||||
from game.game import Game
|
||||
|
||||
|
||||
def test_game_initializes_and_runs_briefly():
|
||||
# Ensure pygame uses the dummy driver
|
||||
assert pygame.get_sdl_version() is not None
|
||||
|
||||
# Instantiate the game and run for a tiny amount of time
|
||||
g = Game(width=320, height=240, fps=60)
|
||||
# Run the loop for 0.1 seconds using run(max_run_seconds=...)
|
||||
g.run(max_run_seconds=0.1)
|
||||
|
||||
# If we reached cleanup without exception, consider test passed
|
||||
assert not pygame.get_init() # pygame.quit() should have been called
|
||||
Loading…
Add table
Add a link
Reference in a new issue