Skip to content

Commit

Permalink
Fix uilabel tests on windows (#2362)
Browse files Browse the repository at this point in the history
  • Loading branch information
einarf authored Sep 7, 2024
1 parent 798ae21 commit 5c4bc93
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/unit/gui/test_uilabel.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def test_constructor_only_text_no_size(window):
label = UILabel(text="Example")

assert label.rect.width == pytest.approx(
63, abs=7
63, abs=10
) # on windows the width differs about 6 pixel
assert label.rect.height == pytest.approx(19, abs=1)

Expand Down Expand Up @@ -48,21 +48,21 @@ def test_constructor_adaptive_width_support_for_multiline_text(window):

def test_with_border_keeps_previous_size(window):
label = UILabel(text="Example")
assert label.rect.width == pytest.approx(63, abs=7)
assert label.rect.width == pytest.approx(63, abs=10)
assert label.rect.height == pytest.approx(19, abs=6)

label.with_border()
assert label.rect.width == pytest.approx(63, abs=7)
assert label.rect.width == pytest.approx(63, abs=10)
assert label.rect.height == pytest.approx(19, abs=6)


def test_with_padding_keeps_previous_size(window):
label = UILabel(text="Example")
assert label.rect.width == pytest.approx(63, abs=7)
assert label.rect.width == pytest.approx(63, abs=10)
assert label.rect.height == pytest.approx(19, abs=6)

label.with_padding(all=2)
assert label.rect.width == pytest.approx(63, abs=7)
assert label.rect.width == pytest.approx(63, abs=10)
assert label.rect.height == pytest.approx(19, abs=6)


Expand Down Expand Up @@ -193,7 +193,7 @@ def test_integration_with_layout_fit_to_content(ui):
ui.execute_layout()

# auto size should fit the text
assert label.rect.width == pytest.approx(63, abs=7)
assert label.rect.width == pytest.approx(63, abs=10)
assert label.rect.height == pytest.approx(19, abs=6)

# even when text changed
Expand Down Expand Up @@ -221,7 +221,7 @@ def test_fit_content_overrides_width(ui):

label.fit_content()

assert label.rect.width == pytest.approx(63, abs=7)
assert label.rect.width == pytest.approx(63, abs=10)
assert label.rect.height == pytest.approx(19, abs=6)


Expand Down

0 comments on commit 5c4bc93

Please sign in to comment.