-
Notifications
You must be signed in to change notification settings - Fork 815
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Snapshot test to keep tabs on opacity.
This snapshot will be used to make sure that the opacity is being taken into account when rendering widgets. This shows that some of the issues in #3304 and #3413.
- Loading branch information
1 parent
afdaa85
commit de6a479
Showing
1 changed file
with
72 additions
and
0 deletions.
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
tests/snapshot_tests/snapshot_apps/component_classes_opacity.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,72 @@ | ||
from textual.app import App, ComposeResult | ||
from textual.widgets import ( | ||
Checkbox, | ||
OptionList, | ||
DataTable, | ||
DirectoryTree, | ||
Footer, | ||
Input, | ||
ProgressBar, | ||
RadioButton, | ||
SelectionList, | ||
Switch, | ||
Tree, | ||
) | ||
from textual.widgets.option_list import Option | ||
|
||
|
||
class ComponentClassesOpacity(App[None]): | ||
BINDINGS = [("n", "notification", "random Notification")] | ||
|
||
CSS = """ | ||
* { | ||
max-height: 3; | ||
} | ||
Checkbox > .toggle--label, | ||
DataTable > .datatable--header, | ||
DirectoryTree > .directory-tree--file, | ||
DirectoryTree > .directory-tree--folder, | ||
Footer > .footer--description, | ||
Footer > .footer--key, | ||
Input > .input--placeholder, | ||
OptionList > .option-list--option-highlighted, | ||
ProgressBar Bar > .bar--indeterminate, | ||
RadioButton > .toggle--label, | ||
SelectionList > .selection-list--button-highlighted, | ||
Switch > .switch--slider, | ||
Toast > .toast--title, | ||
Tree > .tree--label { | ||
text-opacity: 0%; | ||
color: white; | ||
} | ||
""" | ||
|
||
def compose(self) -> ComposeResult: | ||
yield Checkbox("this should be invisible") | ||
dt = DataTable() | ||
dt.add_column("this should be invisible") | ||
yield dt | ||
yield DirectoryTree(".") | ||
yield Footer() | ||
yield Input(placeholder="this should be invisible") | ||
yield OptionList(Option("this should be invisible")) | ||
yield ProgressBar() | ||
yield RadioButton("this should be invisible") | ||
yield SelectionList(("this should be invisible", 0)) | ||
yield Switch() | ||
tree: Tree = Tree("Dune") | ||
tree.root.expand() | ||
characters = tree.root.add("Characters", expand=True) | ||
characters.add_leaf("Paul") | ||
characters.add_leaf("Jessica") | ||
characters.add_leaf("Chani") | ||
yield tree | ||
|
||
def action_notification(self): | ||
self.notify( | ||
title="this should be invisible", message="this should be invisible" | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
ComponentClassesOpacity().run() |