MCPcopy
hub / github.com/Textualize/textual / test_compositor_scroll_placements

Function test_compositor_scroll_placements

tests/test_compositor.py:6–42  ·  view source on GitHub ↗

Regression test for https://github.com/Textualize/textual/issues/5249 The Static should remain visible.

()

Source from the content-addressed store, hash-verified

4
5
6async def test_compositor_scroll_placements():
7 """Regression test for https://github.com/Textualize/textual/issues/5249
8 The Static should remain visible.
9 """
10
11 class ScrollApp(App):
12 CSS = """
13 Screen {
14 overflow: scroll;
15 }
16 Container {
17 width: 200vw;
18 }
19 #hello {
20 width: 20;
21 height: 10;
22 offset: 50 10;
23 background: blue;
24 color: white;
25 }
26 """
27
28 def compose(self) -> ComposeResult:
29 with Container():
30 yield Static("Hello", id="hello")
31
32 def on_mount(self) -> None:
33 self.screen.scroll_to(20, 0, animate=False)
34
35 app = ScrollApp()
36 async with app.run_test() as pilot:
37 await pilot.pause()
38 static = app.query_one("#hello")
39 widgets = app.screen._compositor.visible_widgets
40 # The static wasn't scrolled out of view, and should be visible
41 # This wasn't the case <= v0.86.1
42 assert static in widgets

Callers

nothing calls this directly

Calls 4

ScrollAppClass · 0.85
run_testMethod · 0.80
query_oneMethod · 0.80
pauseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…