Test clicking on the screen
This commit is contained in:
@ -216,6 +216,33 @@ class TestGame(unittest.TestCase):
|
||||
self.game.handle_key_pressed(KeyValues.SPACE)
|
||||
self.assertEqual(self.game.state, GameMode.MAINMENU)
|
||||
|
||||
def test_mouse_click(self) -> None:
|
||||
"""
|
||||
Simulate mouse clicks.
|
||||
"""
|
||||
self.game.state = GameMode.MAINMENU
|
||||
|
||||
# Settings menu
|
||||
self.game.display_actions(DisplayActions.MOUSE, 25, 21)
|
||||
self.assertEqual(self.game.main_menu.position, 4)
|
||||
self.assertEqual(self.game.state, GameMode.SETTINGS)
|
||||
|
||||
bomb = Bomb()
|
||||
bomb.hold(self.game.player)
|
||||
bomb2 = Bomb()
|
||||
bomb2.hold(self.game.player)
|
||||
|
||||
self.game.state = GameMode.INVENTORY
|
||||
|
||||
# Click nowhere
|
||||
self.game.display_actions(DisplayActions.MOUSE, 0, 0)
|
||||
self.assertEqual(self.game.state, GameMode.INVENTORY)
|
||||
|
||||
# Click on the second item
|
||||
self.game.display_actions(DisplayActions.MOUSE, 8, 25)
|
||||
self.assertEqual(self.game.state, GameMode.INVENTORY)
|
||||
self.assertEqual(self.game.inventory_menu.position, 1)
|
||||
|
||||
def test_new_game(self) -> None:
|
||||
"""
|
||||
Ensure that the start button starts a new game.
|
||||
|
Reference in New Issue
Block a user