mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-07 03:00:29 +00:00
fabro(01KT9X0N42W6PRBVH2N5914EQJ): impl_integration (succeeded)
Fabro-Run: 01KT9X0N42W6PRBVH2N5914EQJ
Fabro-Completed: 15
Fabro-Checkpoint: 1c3d6d6c0e
⚒️ Generated with [Fabro](https://fabro.sh)
This commit is contained in:
parent
288709fcfa
commit
a08bed06e1
1 changed files with 31 additions and 0 deletions
|
|
@ -414,6 +414,37 @@ class TestSolitaireUI(unittest.TestCase):
|
|||
stdscr.addstr.assert_any_call(0, 2, "KLONDIKE SOLITAIRE", unittest.mock.ANY)
|
||||
stdscr.addstr.assert_any_call(3, 2, "STOCK", unittest.mock.ANY)
|
||||
|
||||
def test_ui_auto_move(self):
|
||||
# 1. No valid moves available initially
|
||||
self.tui.cursor_zone = 'top'
|
||||
self.tui.cursor_col = 1
|
||||
self.game.waste.clear()
|
||||
self.tui.handle_auto_move()
|
||||
self.assertEqual(self.tui.status_msg, "No valid Foundation move available.")
|
||||
|
||||
# 2. Waste has Ace of Hearts, should auto-move to first foundation
|
||||
self.game.waste.append(Card('H', 1, is_face_up=True))
|
||||
for f in self.game.foundations:
|
||||
f.clear()
|
||||
self.tui.handle_auto_move()
|
||||
self.assertEqual(len(self.game.foundations[0]), 1)
|
||||
self.assertEqual(self.game.foundations[0][-1].suit, 'H')
|
||||
self.assertEqual(self.game.foundations[0][-1].rank, 1)
|
||||
self.assertEqual(self.tui.status_msg, "Auto-moved card to Foundation 1.")
|
||||
|
||||
# 3. Tableau column 0 has Ace of Spades, cursor is on column 0
|
||||
self.game.tableau[0] = [Card('S', 1, is_face_up=True)]
|
||||
self.tui.cursor_zone = 'bottom'
|
||||
self.tui.cursor_col = 0
|
||||
self.tui.cursor_card_idx = 0
|
||||
self.tui.handle_auto_move()
|
||||
self.assertEqual(len(self.game.tableau[0]), 0)
|
||||
self.assertEqual(len(self.game.foundations[1]), 1) # moves to next empty foundation
|
||||
self.assertEqual(self.game.foundations[1][-1].suit, 'S')
|
||||
self.assertEqual(self.game.foundations[1][-1].rank, 1)
|
||||
self.assertEqual(self.tui.status_msg, "Auto-moved card to Foundation 2.")
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue