| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5604e0a commit 77ba07f
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,13 +1,20 @@ | |||
| 1 | 1 | """Demo screen for [`pn.FlatList`][pythonnative.FlatList]. | |
| 2 | 2 | ||
| 3 | - Renders a virtualized list of 100 rows. Maestro asserts the first | ||
| 4 | - row, scrolls down, and asserts a row further into the list. | ||
| 3 | + Renders a virtualized list of 40 rows. Maestro asserts the first row, | ||
| 4 | + scrolls to the end, and asserts the last row. | ||
| 5 | 5 | ||
| 6 | 6 | Because the demo passes a fixed ``item_height`` (with no header, | |
| 7 | 7 | footer, or refresh control), on Android and iOS this list takes the | |
| 8 | 8 | **native** virtualization path: a ``RecyclerView`` / ``UITableView`` | |
| 9 | 9 | whose rows are nested PythonNative subtrees mounted on demand. The | |
| 10 | 10 | scroll assertion therefore exercises native cell recycling end to end. | |
| 11 | + | ||
| 12 | + The flow targets the *last* row because a Maestro fling can travel | ||
| 13 | + several hundred points between visibility polls, skipping clean past | ||
| 14 | + a mid-list row that's only in the accessibility tree while on screen | ||
| 15 | + (rows are recycled natively). The end of the list can't be overshot. | ||
| 16 | + 40 rows is still ~5 screenfuls of the list box, so recycling is | ||
| 17 | + genuinely exercised, while keeping the scroll to a handful of swipes. | ||
| 11 | 18 | """ | |
| 12 | 19 | ||
| 13 | 20 | from __future__ import annotations | |
@@ -18,8 +25,8 @@ | |||
| 18 | 25 | ||
| 19 | 26 | @pn.component | |
| 20 | 27 | def FlatListDemo() -> pn.Element: | |
| 21 | - """Render a virtualized 100-row FlatList with stable row labels.""" | ||
| 22 | - items = [{"id": i, "label": f"FlatRow {i + 1}"} for i in range(100)] | ||
| 28 | + """Render a virtualized 40-row FlatList with stable row labels.""" | ||
| 29 | + items = [{"id": i, "label": f"FlatRow {i + 1}"} for i in range(40)] | ||
| 23 | 30 | ||
| 24 | 31 | def render_row(item: dict, _: int) -> pn.Element: | |
| 25 | 32 | return pn.View( | |
@@ -47,6 +54,6 @@ def render_row(item: dict, _: int) -> pn.Element: | |||
| 47 | 54 | key_extractor=lambda item, _: str(item["id"]), | |
| 48 | 55 | style=pn.style(height=400, background_color="#F1F5F9"), | |
| 49 | 56 | ), | |
| 50 | - hint("Maestro asserts 'FlatRow 1' and (after scroll) 'FlatRow 20'."), | ||
| 57 | + hint("Maestro asserts 'FlatRow 1' and (after scroll) 'FlatRow 40'."), | ||
| 51 | 58 | ), | |
| 52 | 59 | ) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,18 +19,21 @@ appId: ${APP_ID} | |||
| 19 | 19 | CATEGORY: Components | |
| 20 | 20 | DEMO_TITLE: FlatList | |
| 21 | 21 | - assertVisible: "FlatRow 1" | |
| 22 | - # Generous timeout plus a settle pause: every hierarchy poll between | ||
| 23 | - # swipes materializes accessibility cells for the whole list, which is | ||
| 24 | - # slow on the CI simulator, so the default-ish 20 s budget can expire | ||
| 25 | - # after only a few swipes even though scrolling works fine. | ||
| 22 | + # Target the *last* row. Virtualized rows exist in the accessibility | ||
| 23 | + # tree only while on screen, and one Maestro fling can travel several | ||
| 24 | + # hundred points between visibility polls, so a mid-list target (say | ||
| 25 | + # row 20 of 100) can be recycled away between polls and never observed | ||
| 26 | + # -- the scroll then sails to the bottom and times out. The last row | ||
| 27 | + # cannot be overshot. The generous timeout and settle pause absorb the | ||
| 28 | + # slow CI simulator, where each poll re-snapshots the hierarchy. | ||
| 26 | 29 | - scrollUntilVisible: | |
| 27 | - element: "FlatRow 20" | ||
| 30 | + element: "FlatRow 40" | ||
| 28 | 31 | direction: DOWN | |
| 29 | 32 | timeout: 45000 | |
| 30 | 33 | waitToSettleTimeoutMs: 500 | |
| 31 | 34 | visibilityPercentage: 100 | |
| 32 | 35 | centerElement: false | |
| 33 | - - assertVisible: "FlatRow 20" | ||
| 36 | + - assertVisible: "FlatRow 40" | ||
| 34 | 37 | - runFlow: | |
| 35 | 38 | file: ../../helpers/close_demo.yaml | |
| 36 | 39 | env: | |
| Back | FazBrowse Home | New Git URL |
0 commit comments