Skip to content

Commit

Permalink
test: update display test for segment1
Browse files Browse the repository at this point in the history
  • Loading branch information
unRARed committed Dec 9, 2024
1 parent b0b6ef1 commit 215782c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 37 deletions.
2 changes: 2 additions & 0 deletions tests/death_save.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#from objprint import op

##################
# Helper Methods #
##################
Expand Down
15 changes: 15 additions & 0 deletions tests/death_save_mc_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,18 @@ def _assertIncrement(self, var, switch, value):

def _start(self):
death_save._start(self)

# Helper function to check for existence
# of test on the display.
#
# Example:
#
# self.assertIn('Some value',
# [x.text for x in self._get_display_text_widgets])
#
def _get_display_text_widgets(self):
current_widgets = []
for w in self.mc.displays['apron'].current_slide.widgets:
if hasattr(w.widget, 'text'):
current_widgets.append(w.widget)
return current_widgets
51 changes: 14 additions & 37 deletions tests/test_displays.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,21 @@

class TestDisplays(DeathSaveMcTesting):

def test_game_loop(self):
# TODO: Figure out how to test segment displays

def test_segment1(self):
self.assertModeRunning("attract")

## TODO: decide what to display on the segments
## during the attract mode
#widgets = self._get_display_text_widgets()
#self.assertIn(
# "1234567", [x.text for x in widgets]
#)

## game begins and puts player1's score
## on the segment display
#self.hit_and_release_switch("s_start")
#self.advance_time_and_run(1)

#widgets = self._get_display_text_widgets()
#self.assertIn(
# self.machine.game.player.score,
# [int(x.text) for x in widgets]
#)

## start game and player scores 10 points
## by hitting the grand advance switch
#self.hit_and_release_switch("s_shooter_lane")
#self.hit_and_release_switch("s_grand_advance")
#self.advance_time_and_run(4)
#widgets = self._get_display_text_widgets()
#self.assertIn(10, [int(x.text) for x in widgets])

##############
### Helpers ##
##############

#def _get_display_text_widgets(self):
#current_widgets = []
#for wgt in self.mc.displays['apron'].current_slide.widgets:
# if hasattr(wgt.widget, 'text'):
# current_widgets.append(wgt.widget)
#return current_widgets
self.hit_and_release_switch("s_start")
self.hit_and_release_switch("s_shooter_lane")
self.advance_time_and_run(1)

self.assertEqual(self.machine.game.player.score,
int(self.machine.segment_displays['segment1'].text))

## player scores 10 points by hitting the
## grand advance switch scoring 10 points
self.hit_and_release_switch("s_grand_advance")
self.advance_time_and_run(1)
self.assertEqual(10,
int(self.machine.segment_displays['segment1'].text))

0 comments on commit 215782c

Please sign in to comment.