File: test_box_drawing.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 (25 lines) | stat: -rw-r--r-- 905 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
20
21
22
23
24
25
import pytest

from textual._box_drawing import combine_quads


@pytest.mark.parametrize(
    "quad1, quad2, expected",
    [
        ((0, 0, 0, 0), (0, 0, 0, 0), (0, 0, 0, 0)),
        ((0, 0, 0, 1), (0, 0, 0, 0), (0, 0, 0, 1)),
        ((0, 0, 0, 1), (0, 0, 0, 1), (0, 0, 0, 1)),
        ((0, 0, 0, 2), (0, 0, 0, 1), (0, 0, 0, 1)),
        ((0, 0, 0, 2), (1, 2, 3, 0), (1, 2, 3, 2)),
        ((0, 1, 0, 2), (1, 0, 3, 0), (1, 1, 3, 2)),
        # Repeating to check cached values
        ((0, 0, 0, 0), (0, 0, 0, 0), (0, 0, 0, 0)),
        ((0, 0, 0, 1), (0, 0, 0, 0), (0, 0, 0, 1)),
        ((0, 0, 0, 1), (0, 0, 0, 1), (0, 0, 0, 1)),
        ((0, 0, 0, 2), (0, 0, 0, 1), (0, 0, 0, 1)),
        ((0, 0, 0, 2), (1, 2, 3, 0), (1, 2, 3, 2)),
        ((0, 1, 0, 2), (1, 0, 3, 0), (1, 1, 3, 2)),
    ],
)
def test_box_combine_quads(quad1, quad2, expected):
    assert combine_quads(quad1, quad2) == expected