Skip to content

Commit

Permalink
TST: add combobox test to dynamic text
Browse files Browse the repository at this point in the history
  • Loading branch information
ZLLentz committed Jun 6, 2024
1 parent 46d63b8 commit 1036b83
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions typhos/tests/test_dynamic_font.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
[
QtWidgets.QLabel,
QtWidgets.QPushButton,
QtWidgets.QComboBox,
PyDMLabel,
]
)
Expand All @@ -28,7 +29,10 @@ def test_patching(
qtbot: pytestqt.qtbot.QtBot,
) -> None:
widget = cls()
widget.setText("Test\ntext")
if isinstance(widget, QtWidgets.QComboBox):
widget.addItems(["test", "text"])
else:
widget.setText("Test\ntext")
widget.setFixedSize(500, 500)
qtbot.add_widget(widget)

Expand All @@ -55,11 +59,12 @@ def test_patching(
logger.debug(f"ResizeEvent patched font size is {resized_font_size}")
assert original_font_size != resized_font_size

# Font size case 2: text is updated
widget.setText(widget.text()*100)
new_text_font_size = widget.font().pointSizeF()
logger.debug(f"setText patched font size is {new_text_font_size}")
assert resized_font_size != new_text_font_size
# Font size case 2: text is updated (not supported in combobox yet)
if not isinstance(widget, QtWidgets.QComboBox):
widget.setText(widget.text()*100)
new_text_font_size = widget.font().pointSizeF()
logger.debug(f"setText patched font size is {new_text_font_size}")
assert resized_font_size != new_text_font_size

assert is_patched(widget)
unpatch_widget(widget)
Expand Down

0 comments on commit 1036b83

Please sign in to comment.