Skip to content

Commit 443f959

Browse files
Add back_screen test
1 parent 6969472 commit 443f959

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

tests/test_graphical_foreground_app.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import unittest
77

88
from mpos import AppManager
9-
from mpos.ui import get_foreground_app
9+
from mpos.ui import back_screen, get_foreground_app
1010
from mpos.ui.testing import wait_for_render
1111

1212

@@ -47,3 +47,28 @@ def test_get_foreground_app_after_starting_apps(self):
4747
about_fullname,
4848
f"Foreground app mismatch: expected {about_fullname}, got {fg}",
4949
)
50+
51+
def test_get_foreground_app_after_back_screen(self):
52+
launcher_fullname = "com.micropythonos.launcher"
53+
about_fullname = "com.micropythonos.about"
54+
55+
AppManager.start_app(launcher_fullname)
56+
wait_for_render(iterations=30)
57+
self.assertTrue(
58+
self._wait_for_foreground(launcher_fullname),
59+
f"Expected foreground app to be {launcher_fullname}, got {get_foreground_app()}",
60+
)
61+
62+
AppManager.start_app(about_fullname)
63+
wait_for_render(iterations=30)
64+
self.assertTrue(
65+
self._wait_for_foreground(about_fullname),
66+
f"Expected foreground app to be {about_fullname}, got {get_foreground_app()}",
67+
)
68+
69+
back_screen()
70+
wait_for_render(iterations=30)
71+
self.assertTrue(
72+
self._wait_for_foreground(launcher_fullname),
73+
f"Expected foreground app to be {launcher_fullname} after back_screen, got {get_foreground_app()}",
74+
)

0 commit comments

Comments
 (0)