Files
textual/tests/snapshot_tests/snapshot_apps/scrollbar_thumb_height.py
Rodrigo Girão Serrão e5033d7d23 Remove hanging lines from docstrings. (#2349)
* Remove hanging lines from docstrings.

Deleted hanging blank lines at the end of docstrings.

Regex pattern:
 - find `\n\n( *)"""`
 - replace with `\n$1"""`
2023-04-24 11:21:38 +01:00

45 lines
1.1 KiB
Python

from rich.segment import Segment
from textual.app import App, ComposeResult
from textual.widgets import Header, Footer
from textual.scroll_view import ScrollView
from textual.strip import Strip
from textual.geometry import Size
class TestScrollView(ScrollView, can_focus=True):
def __init__(self, height: int, border_title: str) -> None:
super().__init__()
self.virtual_size = Size(0, height)
self.border_title = border_title
def render_line(self, y: int) -> Strip:
return Strip(
[
Segment(f"Welcome to line {self.scroll_offset.y + y}"),
]
)
class ScrollViewTester(App[None]):
"""Check the scrollbar fits the end."""
CSS = """
TestScrollView {
background: $primary-darken-2;
border: round red;
}
"""
def compose(self) -> ComposeResult:
yield Header()
yield TestScrollView(height=1000, border_title=f"1")
yield Footer()
def on_ready(self) -> None:
self.query_one(TestScrollView).scroll_end(animate=False)
if __name__ == "__main__":
ScrollViewTester().run()