-
Notifications
You must be signed in to change notification settings - Fork 819
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
044fbdb
commit 052f81b
Showing
8 changed files
with
1,399 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
""" | ||
Regression test for https://github.com/Textualize/textual/issues/3721 | ||
and follow-up issues that were discovered. | ||
""" | ||
|
||
from textual.app import App, ComposeResult | ||
from textual.containers import Horizontal, Vertical | ||
from textual.widgets import Input, TextArea, Label, Button, DataTable | ||
|
||
|
||
class DimensionsApp(App[None]): | ||
CSS = """ | ||
Vertical { | ||
width: auto; | ||
} | ||
.ruler { | ||
text-style: reverse; | ||
height: 24; | ||
width: 1; | ||
} | ||
.target { | ||
width: 3; | ||
height: 50%; | ||
border: solid red; | ||
box-sizing: border-box; | ||
} | ||
Input.target, Button.target, TextArea.target, DataTable.target { | ||
width: 12; | ||
min-width: 0; # "Unset" Button's min-width. | ||
} | ||
.padding { | ||
padding: 1 0; | ||
} | ||
.margin { | ||
margin: 2 0; | ||
} | ||
""" | ||
|
||
def compose(self) -> ComposeResult: | ||
with Horizontal(): | ||
yield Label("1234567890" * 3, classes="ruler") | ||
with Vertical(): | ||
yield Label("123456789012", classes="target") | ||
yield Label("123456789012", classes="target") | ||
with Vertical(): | ||
yield Label("123456789012", classes="target padding") | ||
yield Label("123456789012", classes="target padding") | ||
yield Label("1234567890" * 3, classes="ruler") | ||
with Vertical(): | ||
yield Label("123456789012", classes="target margin") | ||
yield Label("123456789012", classes="target") | ||
with Vertical(): | ||
yield Label("123456789012", classes="target padding margin") | ||
yield Label("123456789012", classes="target padding") | ||
yield Label("1234567890" * 3, classes="ruler") | ||
with Vertical(): | ||
yield Input(classes="target") | ||
yield Button(classes="target") | ||
with Vertical(): | ||
yield TextArea(classes="target") | ||
yield DataTable(classes="target") | ||
|
||
|
||
if __name__ == "__main__": | ||
DimensionsApp().run() |
71 changes: 71 additions & 0 deletions
71
tests/snapshot_tests/snapshot_apps/dimensions_max_height.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
""" | ||
Regression test for https://github.com/Textualize/textual/issues/3721 | ||
and follow-up issues that were discovered. | ||
""" | ||
|
||
from textual.app import App, ComposeResult | ||
from textual.containers import Horizontal, Vertical | ||
from textual.widgets import Input, TextArea, Label, Button, DataTable | ||
|
||
|
||
class DimensionsApp(App[None]): | ||
CSS = """ | ||
Vertical { | ||
width: auto; | ||
} | ||
.ruler { | ||
text-style: reverse; | ||
height: 24; | ||
width: 1; | ||
} | ||
.target { | ||
width: 3; | ||
height: 24; | ||
max-height: 50%; | ||
border: solid red; | ||
box-sizing: border-box; | ||
} | ||
Input.target, Button.target, TextArea.target, DataTable.target { | ||
width: 12; | ||
min-width: 0; # "Unset" Button's min-width. | ||
} | ||
.padding { | ||
padding: 1 0; | ||
} | ||
.margin { | ||
margin: 2 0; | ||
} | ||
""" | ||
|
||
def compose(self) -> ComposeResult: | ||
with Horizontal(): | ||
yield Label("1234567890" * 3, classes="ruler") | ||
with Vertical(): | ||
yield Label("123456789012", classes="target") | ||
yield Label("123456789012", classes="target") | ||
with Vertical(): | ||
yield Label("123456789012", classes="target padding") | ||
yield Label("123456789012", classes="target padding") | ||
yield Label("1234567890" * 3, classes="ruler") | ||
with Vertical(): | ||
yield Label("123456789012", classes="target margin") | ||
yield Label("123456789012", classes="target") | ||
with Vertical(): | ||
yield Label("123456789012", classes="target padding margin") | ||
yield Label("123456789012", classes="target padding") | ||
yield Label("1234567890" * 3, classes="ruler") | ||
with Vertical(): | ||
yield Input(classes="target") | ||
yield Button(classes="target") | ||
with Vertical(): | ||
yield TextArea(classes="target") | ||
yield DataTable(classes="target") | ||
|
||
|
||
if __name__ == "__main__": | ||
DimensionsApp().run() |
62 changes: 62 additions & 0 deletions
62
tests/snapshot_tests/snapshot_apps/dimensions_max_width.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
""" | ||
Regression test for https://github.com/Textualize/textual/issues/3721 | ||
and follow-up issues that were discovered. | ||
""" | ||
|
||
from textual.app import App, ComposeResult | ||
from textual.containers import Horizontal | ||
from textual.widgets import Input, TextArea, Label, Button, DataTable | ||
|
||
|
||
class DimensionsApp(App[None]): | ||
CSS = """ | ||
Horizontal { | ||
height: auto; | ||
} | ||
.ruler { | ||
text-style: reverse; | ||
} | ||
.target { | ||
width: 80; | ||
max-width: 50%; | ||
height: 3; | ||
border: solid red; | ||
box-sizing: border-box; | ||
} | ||
.padding { | ||
padding: 0 6; | ||
} | ||
.margin { | ||
margin: 0 10; | ||
} | ||
""" | ||
|
||
def compose(self) -> ComposeResult: | ||
yield Label("1234567890" * 8, classes="ruler") | ||
with Horizontal(): | ||
yield Label("1234567890" * 4, classes="target") | ||
yield Label("1234567890" * 4, classes="target") | ||
with Horizontal(): | ||
yield Label("1234567890" * 4, classes="target padding") | ||
yield Label("1234567890" * 4, classes="target padding") | ||
yield Label("1234567890" * 8, classes="ruler") | ||
with Horizontal(): | ||
yield Label("1234567890" * 4, classes="target margin") | ||
yield Label("1234567890" * 4, classes="target") | ||
with Horizontal(): | ||
yield Label("1234567890" * 4, classes="target padding margin") | ||
yield Label("1234567890" * 4, classes="target padding") | ||
with Horizontal(): | ||
yield Input(classes="target") | ||
yield Button(classes="target") | ||
with Horizontal(): | ||
yield TextArea(classes="target") | ||
yield DataTable(classes="target") | ||
|
||
|
||
if __name__ == "__main__": | ||
DimensionsApp().run() |
71 changes: 71 additions & 0 deletions
71
tests/snapshot_tests/snapshot_apps/dimensions_min_height.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
""" | ||
Regression test for https://github.com/Textualize/textual/issues/3721 | ||
and follow-up issues that were discovered. | ||
""" | ||
|
||
from textual.app import App, ComposeResult | ||
from textual.containers import Horizontal, Vertical | ||
from textual.widgets import Input, TextArea, Label, Button, DataTable | ||
|
||
|
||
class DimensionsApp(App[None]): | ||
CSS = """ | ||
Vertical { | ||
width: auto; | ||
} | ||
.ruler { | ||
text-style: reverse; | ||
height: 24; | ||
width: 1; | ||
} | ||
.target { | ||
width: 3; | ||
height: 0; | ||
min-height: 50%; | ||
border: solid red; | ||
box-sizing: border-box; | ||
} | ||
Input.target, Button.target, TextArea.target, DataTable.target { | ||
width: 12; | ||
min-width: 0; # "Unset" Button's min-width. | ||
} | ||
.padding { | ||
padding: 1 0; | ||
} | ||
.margin { | ||
margin: 2 0; | ||
} | ||
""" | ||
|
||
def compose(self) -> ComposeResult: | ||
with Horizontal(): | ||
yield Label("1234567890" * 3, classes="ruler") | ||
with Vertical(): | ||
yield Label("123456789012", classes="target") | ||
yield Label("123456789012", classes="target") | ||
with Vertical(): | ||
yield Label("123456789012", classes="target padding") | ||
yield Label("123456789012", classes="target padding") | ||
yield Label("1234567890" * 3, classes="ruler") | ||
with Vertical(): | ||
yield Label("123456789012", classes="target margin") | ||
yield Label("123456789012", classes="target") | ||
with Vertical(): | ||
yield Label("123456789012", classes="target padding margin") | ||
yield Label("123456789012", classes="target padding") | ||
yield Label("1234567890" * 3, classes="ruler") | ||
with Vertical(): | ||
yield Input(classes="target") | ||
yield Button(classes="target") | ||
with Vertical(): | ||
yield TextArea(classes="target") | ||
yield DataTable(classes="target") | ||
|
||
|
||
if __name__ == "__main__": | ||
DimensionsApp().run() |
62 changes: 62 additions & 0 deletions
62
tests/snapshot_tests/snapshot_apps/dimensions_min_width.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
""" | ||
Regression test for https://github.com/Textualize/textual/issues/3721 | ||
and follow-up issues that were discovered. | ||
""" | ||
|
||
from textual.app import App, ComposeResult | ||
from textual.containers import Horizontal | ||
from textual.widgets import Input, TextArea, Label, Button, DataTable | ||
|
||
|
||
class DimensionsApp(App[None]): | ||
CSS = """ | ||
Horizontal { | ||
height: auto; | ||
} | ||
.ruler { | ||
text-style: reverse; | ||
} | ||
.target { | ||
width: 0; | ||
min-width: 50%; | ||
height: 3; | ||
border: solid red; | ||
box-sizing: border-box; | ||
} | ||
.padding { | ||
padding: 0 6; | ||
} | ||
.margin { | ||
margin: 0 10; | ||
} | ||
""" | ||
|
||
def compose(self) -> ComposeResult: | ||
yield Label("1234567890" * 8, classes="ruler") | ||
with Horizontal(): | ||
yield Label("1234567890" * 4, classes="target") | ||
yield Label("1234567890" * 4, classes="target") | ||
with Horizontal(): | ||
yield Label("1234567890" * 4, classes="target padding") | ||
yield Label("1234567890" * 4, classes="target padding") | ||
yield Label("1234567890" * 8, classes="ruler") | ||
with Horizontal(): | ||
yield Label("1234567890" * 4, classes="target margin") | ||
yield Label("1234567890" * 4, classes="target") | ||
with Horizontal(): | ||
yield Label("1234567890" * 4, classes="target padding margin") | ||
yield Label("1234567890" * 4, classes="target padding") | ||
with Horizontal(): | ||
yield Input(classes="target") | ||
yield Button(classes="target") | ||
with Horizontal(): | ||
yield TextArea(classes="target") | ||
yield DataTable(classes="target") | ||
|
||
|
||
if __name__ == "__main__": | ||
DimensionsApp().run() |
Oops, something went wrong.