Test main menu scrolling
This commit is contained in:
parent
60d6c7509a
commit
30a01108b8
|
@ -28,7 +28,7 @@ class MainMenu(Menu):
|
|||
values = [e for e in MainMenuValues]
|
||||
|
||||
|
||||
class ArbitraryMenu:
|
||||
class ArbitraryMenu(Menu):
|
||||
def __init__(self, values: list):
|
||||
super().__init__(self)
|
||||
super().__init__()
|
||||
self.values = values
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
import unittest
|
||||
|
||||
from dungeonbattle.menus import ArbitraryMenu, MainMenu, MainMenuValues
|
||||
|
||||
|
||||
class TestMenus(unittest.TestCase):
|
||||
def test_scroll_menu(self) -> None:
|
||||
"""
|
||||
Test to scroll the menu.
|
||||
"""
|
||||
arbitrary_menu = ArbitraryMenu([])
|
||||
self.assertEqual(arbitrary_menu.position, 0)
|
||||
|
||||
main_menu = MainMenu()
|
||||
self.assertEqual(main_menu.position, 0)
|
||||
self.assertEqual(main_menu.validate(), MainMenuValues.START)
|
||||
main_menu.go_up()
|
||||
self.assertEqual(main_menu.validate(), MainMenuValues.START)
|
||||
main_menu.go_down()
|
||||
self.assertEqual(main_menu.validate(), MainMenuValues.SETTINGS)
|
||||
main_menu.go_down()
|
||||
self.assertEqual(main_menu.validate(), MainMenuValues.EXIT)
|
||||
main_menu.go_down()
|
||||
self.assertEqual(main_menu.validate(), MainMenuValues.EXIT)
|
Loading…
Reference in New Issue