Test clicking on the merchant pad

This commit is contained in:
Yohann D'ANELLO 2020-12-11 18:44:05 +01:00
parent 53d090a9c8
commit a4a10e340d
2 changed files with 3 additions and 2 deletions

View File

@ -99,7 +99,7 @@ class DisplayManager:
self.playerinventorydisplay.refresh( self.playerinventorydisplay.refresh(
self.rows // 10, self.cols // 2, self.rows // 10, self.cols // 2,
8 * self.rows // 10, 2 * self.cols // 5) 8 * self.rows // 10, 2 * self.cols // 5)
displays.append(self.inventorydisplay) displays.append(self.playerinventorydisplay)
elif self.game.state == GameMode.STORE: elif self.game.state == GameMode.STORE:
self.storeinventorydisplay.refresh( self.storeinventorydisplay.refresh(
self.rows // 10, self.cols // 2, self.rows // 10, self.cols // 2,

View File

@ -539,9 +539,10 @@ class TestGame(unittest.TestCase):
# The second item is not a heart # The second item is not a heart
merchant.inventory[1] = Sword() merchant.inventory[1] = Sword()
# Buy the second item # Buy the second item by clicking on it
item = self.game.store_menu.validate() item = self.game.store_menu.validate()
self.assertIn(item, merchant.inventory) self.assertIn(item, merchant.inventory)
self.game.display_actions(DisplayActions.MOUSE, 8, 25)
self.game.handle_key_pressed(KeyValues.ENTER) self.game.handle_key_pressed(KeyValues.ENTER)
self.assertIn(item, self.game.player.inventory) self.assertIn(item, self.game.player.inventory)
self.assertNotIn(item, merchant.inventory) self.assertNotIn(item, merchant.inventory)