File: test_line_filter.py

package info (click to toggle)
textual 2.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 55,084 kB
  • sloc: python: 85,423; lisp: 1,669; makefile: 101
file content (19 lines) | stat: -rw-r--r-- 527 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from rich.segment import Segment
from rich.style import Style

from textual.color import Color
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, Color(0, 0, 0))

    expected = [Segment("Hello, World!", Style.parse("not dim #7f7fff on #0000ff"))]

    assert dimmed_segments == expected