|
6 | 6 | import unittest |
7 | 7 |
|
8 | 8 | from mpos import AppManager |
9 | | -from mpos.ui import get_foreground_app |
| 9 | +from mpos.ui import back_screen, get_foreground_app |
10 | 10 | from mpos.ui.testing import wait_for_render |
11 | 11 |
|
12 | 12 |
|
@@ -47,3 +47,28 @@ def test_get_foreground_app_after_starting_apps(self): |
47 | 47 | about_fullname, |
48 | 48 | f"Foreground app mismatch: expected {about_fullname}, got {fg}", |
49 | 49 | ) |
| 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