Files
textual/tests/test_box_drawing.py
Will McGugan 370f5f7214 Keyline rule (#3669)
* canvas

* imports

* more box drawing

* lines

* lines

* box drawing table

* fix box table

* tweak test

* canvas color

* simplify canvas

* optimization

* clipping

* render experiment

* keyline css

* tests

* don't draw around invisible widgets

* optimize

* snapshot test

* docs and examples

* tab size

* disclaimer

* docs

* changelog

* snapshots

* accidental add

* rename for consistency

* simplify color

* docstrings

* comment

* snapshots

* micro optimize

* micro-optimization

* typing

* set over list

* remove comment

* docstring

* punctuation

* Update docs/styles/keyline.md

Co-authored-by: Darren Burns <darrenburns@users.noreply.github.com>

---------

Co-authored-by: Darren Burns <darrenburns@users.noreply.github.com>
2023-11-27 11:54:53 +00:00

26 lines
905 B
Python

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