mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add a unit test for #2502
Currently marked as xfail, but this gets it down to the most basic level.
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
from fractions import Fraction
|
from fractions import Fraction
|
||||||
|
from itertools import chain
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@@ -122,3 +123,30 @@ def test_resolve_fraction_unit():
|
|||||||
Fraction(32),
|
Fraction(32),
|
||||||
resolve_dimension="width",
|
resolve_dimension="width",
|
||||||
) == Fraction(2)
|
) == Fraction(2)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.xfail(reason="https://github.com/Textualize/textual/issues/2502")
|
||||||
|
def test_resolve_issue_2502():
|
||||||
|
"""Test https://github.com/Textualize/textual/issues/2502"""
|
||||||
|
|
||||||
|
widgets_fr = [Widget() for _ in range(50)]
|
||||||
|
widgets_min_width = [Widget() for _ in range(50)]
|
||||||
|
|
||||||
|
for widget in widgets_fr:
|
||||||
|
widget.styles.width = "1fr"
|
||||||
|
widget.styles.min_width = 3
|
||||||
|
|
||||||
|
for widget in widgets_min_width:
|
||||||
|
widget.styles.width = 0
|
||||||
|
|
||||||
|
styles = (
|
||||||
|
widget.styles
|
||||||
|
for widget in chain.from_iterable(zip(widgets_fr, widgets_min_width))
|
||||||
|
)
|
||||||
|
|
||||||
|
assert isinstance(
|
||||||
|
resolve_fraction_unit(
|
||||||
|
styles, Size(80, 24), Size(80, 24), Fraction(10), resolve_dimension="width"
|
||||||
|
),
|
||||||
|
Fraction,
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user