import pygame from game.cube_game import CubeGame from game.compute import rot_3d def test_rot_3d_z_90(): # Rotating point [1, 0, 0] around z by 90 degrees should give [0, 1, 0] points = [[1.0, 0.0, 0.0]] rotated = rot_3d(points, 90.0, "z") assert round(rotated[0][0], 5) == 0.0 assert round(rotated[0][1], 5) == 1.0 assert round(rotated[0][2], 5) == 0.0 def test_no_key_pressed(): game = CubeGame() initial = game.rotation.copy() game.update_game() assert game.rotation == initial def test_key_press_increments_rotation(): game = CubeGame() event = pygame.event.Event(pygame.KEYDOWN, key=pygame.K_UP) game.handle_event(event) game.update_game() assert game.rotation["x"] == 1.0 event_up = pygame.event.Event(pygame.KEYUP, key=pygame.K_UP) game.handle_event(event_up) game.update_game() assert game.rotation["x"] == 1.0