mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
fix for auto width and relative dimensions
This commit is contained in:
File diff suppressed because one or more lines are too long
37
tests/snapshot_tests/snapshot_apps/columns_height.py
Normal file
37
tests/snapshot_tests/snapshot_apps/columns_height.py
Normal file
@@ -0,0 +1,37 @@
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.containers import Horizontal
|
||||
from textual.widgets import Static
|
||||
|
||||
|
||||
class HeightApp(App[None]):
|
||||
|
||||
CSS = """
|
||||
Horizontal {
|
||||
border: solid red;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
Static {
|
||||
border: solid green;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
#fill_parent {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#static {
|
||||
height: 16;
|
||||
}
|
||||
"""
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
yield Horizontal(
|
||||
Static("As tall as container", id="fill_parent"),
|
||||
Static("This has default\nheight\nbut a\nfew lines"),
|
||||
Static("I have a static height", id="static"),
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
HeightApp().run()
|
||||
@@ -16,7 +16,7 @@ class Body1(Vertical):
|
||||
|
||||
class Body2(Vertical):
|
||||
def compose(self) -> ComposeResult:
|
||||
yield Label("I'm sorry, Dave. I'm afraid I can't do that. " * 300)
|
||||
yield Label("My God! It's full of stars! " * 300)
|
||||
|
||||
|
||||
class Good(Screen):
|
||||
@@ -52,6 +52,10 @@ class Layers(App[None]):
|
||||
background: red;
|
||||
color: yellow;
|
||||
}
|
||||
|
||||
Body2 {
|
||||
background: green;
|
||||
}
|
||||
"""
|
||||
|
||||
SCREENS = {"good": Good, "bad": Bad}
|
||||
|
||||
@@ -139,15 +139,18 @@ def test_multiple_css(snap_compare):
|
||||
|
||||
|
||||
def test_order_independence(snap_compare):
|
||||
# Interaction between multiple CSS files and app-level/classvar CSS
|
||||
assert snap_compare("snapshot_apps/order_independence.py")
|
||||
|
||||
|
||||
def test_order_independence_toggle(snap_compare):
|
||||
# Interaction between multiple CSS files and app-level/classvar CSS
|
||||
assert snap_compare("snapshot_apps/order_independence.py", press="t,_")
|
||||
|
||||
|
||||
def test_columns_height(snap_compare):
|
||||
# Interaction with height auto, and relative heights to make columns
|
||||
assert snap_compare("snapshot_apps/columns_height.py")
|
||||
|
||||
|
||||
# --- Other ---
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user