File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ from textual .app import App , ComposeResult
2+ from textual .containers import Container
3+ from textual .widgets import Static
4+
5+
6+ async def test_compositor_scroll_placements ():
7+ """Regression test for https://github.com/Textualize/textual/issues/5249"""
8+
9+ class ScrollApp (App ):
10+ CSS = """
11+ Screen {
12+ overflow: scroll;
13+ }
14+ Container {
15+ width: 200vw;
16+ }
17+ #hello {
18+ width: 20;
19+ height: 10;
20+ offset: 50 10;
21+ background: blue;
22+ color: white;
23+ }
24+ """
25+
26+ def compose (self ) -> ComposeResult :
27+ with Container ():
28+ yield Static ("Hello" , id = "hello" )
29+
30+ def on_mount (self ) -> None :
31+ self .query_one ("Screen" ).scroll_to (20 , 0 , animate = False )
32+
33+ app = ScrollApp ()
34+ async with app .run_test () as pilot :
35+ await pilot .pause ()
36+ static = app .query_one ("#hello" )
37+ widgets = app .screen ._compositor .visible_widgets
38+ # The static wasn't scrolled out of view, and should be visible
39+ assert static in widgets
You can’t perform that action at this time.
0 commit comments