Skip to content

Commit

Permalink
Added test for submenu inherit for button check
Browse files Browse the repository at this point in the history
  • Loading branch information
ppizarror committed Oct 13, 2024
1 parent 0346a66 commit ab372a6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/test_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -2634,3 +2634,17 @@ def btn() -> None:
# Mainloop also updates last surface
menu.mainloop(disable_loop=True)
self.assertEqual(menu._surface_last, menu_surface)

def test_inheritance(self) -> None:
"""
Test Menu class inheritance.
We check widgets within inherited class. #486
"""

class SubMenu(pygame_menu.Menu):
def __init__(self) -> None:
super().__init__(title='Test', width=150, height=200, theme=pygame_menu.themes.THEME_DARK.copy())
help_menu = pygame_menu.Menu(title='Help', width=150, height=200)
self.add.button(help_menu.get_title(), help_menu)

self.assertEqual(len(SubMenu().get_widgets()), 1)

0 comments on commit ab372a6

Please sign in to comment.