Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix uilabel tests on windows #2362

Merged
merged 1 commit into from
Sep 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading