mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
dim filter (#2323)
* dim filter * optimization * Remove test code * move functions out of filter * docstring * move function to module scope * docstring * docstrings
This commit is contained in:
18
tests/test_line_filter.py
Normal file
18
tests/test_line_filter.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from rich.segment import Segment
|
||||
from rich.style import Style
|
||||
|
||||
from textual.filter import DimFilter
|
||||
|
||||
|
||||
def test_dim_apply():
|
||||
"""Check dim filter changes color and resets dim attribute."""
|
||||
|
||||
dim_filter = DimFilter()
|
||||
|
||||
segments = [Segment("Hello, World!", Style.parse("dim #ffffff on #0000ff"))]
|
||||
|
||||
dimmed_segments = dim_filter.apply(segments)
|
||||
|
||||
expected = [Segment("Hello, World!", Style.parse("not dim #7f7fff on #0000ff"))]
|
||||
|
||||
assert dimmed_segments == expected
|
||||
Reference in New Issue
Block a user