Updated tests.py to add my newest checks

This commit is contained in:
BlueFox 2024-11-01 16:40:09 +00:00
parent 4f1b59efeb
commit ecad7e2403

View File

@ -1,6 +1,7 @@
from lcdMenu import lcdMenu from lcdMenu import lcdMenu
import config import config
from config import LCD from config import LCD
from time import sleep
""" """
# testing different icon styles # testing different icon styles
@ -18,6 +19,7 @@ LCD.putstr(chr(0)+" "+chr(1)+" "+chr(2)+" "+chr(3)+" "+chr(4)+" "+chr(5)+" <>"
#LCD.putstr("< >< some tst itm >") #LCD.putstr("< >< some tst itm >")
LCD.putstr("[ ------------ ]< some tst itm >") LCD.putstr("[ ------------ ]< some tst itm >")
sleep(1)
def some_print(): def some_print():
print("some_print() executed!") print("some_print() executed!")
@ -26,27 +28,27 @@ def another_callback():
def third(): def third():
print("third") print("third")
return True return True
menuItems = [("some_print", some_print), menuItems = [("some_print", some_print),
("another_entry", another_callback), ("another_entry", another_callback),
("third item", third)] ("third item", third)]
lm = lcdMenu(config.LCD, submenu = lcdMenu(config.LCD,
{"next_btn": config.BTN_1, "ok_btn": config.BTN_2}, {"next_btn": config.BTN_2, "ok_btn": config.BTN_1},
menuItems, menuItems,
scroll_direction=True, cycle=True, scroll_direction=True, cycle=True,
hide_menu_name=False) hide_menu_name=False)
print(lm.current_selection) mainmenu = lcdMenu(config.LCD,
lm.next_selection() {"next_btn": config.BTN_2, "ok_btn": config.BTN_1},
print(lm.current_selection) [("submenu",submenu.run)],
lm.next_selection() scroll_direction=True, cycle=True,
print(lm.current_selection) hide_menu_name=False)
lm.next_selection()
print(lm.current_selection) mainmenu.next_selection()
print("--------") mainmenu.previous_selection()
print(lm.current_selection)
lm.previous_selection() print("-------\nNow running!\n-------")
print(lm.current_selection)
lm.previous_selection() submenu.run()
print(lm.current_selection) #mainmenu.run()
lm.previous_selection()
print(lm.current_selection)