From b8ffeca38faeab273faa973152ba487ba8f4b96b Mon Sep 17 00:00:00 2001 From: Kevin Schlosser Date: Mon, 11 Mar 2024 12:11:04 -0600 Subject: [PATCH] ci(micropython): catch event failure in the test (#5787) --- tests/micropy_test/micropy.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/micropy_test/micropy.py b/tests/micropy_test/micropy.py index 9891d3a8a6..e5c10beacd 100644 --- a/tests/micropy_test/micropy.py +++ b/tests/micropy_test/micropy.py @@ -100,6 +100,27 @@ def CANVAS_BUF_SIZE(w, h, bpp, stride): stride - 1)) * h + lv.DRAW_BUF_ALIGN +event_flag = False + + +@test_func_wrapper +def event_callback(e): + global event_flag + event_flag = True + + +@test_func_wrapper +def test_event(): + scr = lv.screen_active() + + scr.add_event_cb(event_callback, lv.EVENT.CLICKED, None) + + scr.send_event(lv.EVENT.CLICKED, None) + + if not event_flag: + raise RuntimeError('Event failure') + + @test_func_wrapper def create_ui(): # Create a colors @@ -421,6 +442,7 @@ def main(): lv.refr_now(None) +test_event() create_ui() main() # end