parent
c8378d0872
commit
96dfd2bbf9
|
|
@ -90,7 +90,11 @@ def test_word_wrap(view, qtbot):
|
|||
])
|
||||
@pytest.mark.parametrize("replace", ["test", None])
|
||||
def test_rich_text(view, qtbot, rich, higher, expected_format, replace):
|
||||
"""Rich text should be rendered appropriately."""
|
||||
"""Rich text should be rendered appropriately.
|
||||
|
||||
This makes sure the title has been rendered as plain text by comparing the
|
||||
heights of the two widgets. To ensure consistent results, we disable word-wrapping.
|
||||
"""
|
||||
level = usertypes.MessageLevel.info
|
||||
text = 'with <h1>markup</h1>'
|
||||
text2 = 'with <h1>markup</h1> 2'
|
||||
|
|
@ -105,6 +109,7 @@ def test_rich_text(view, qtbot, rich, higher, expected_format, replace):
|
|||
with ctx:
|
||||
view.show_message(info1)
|
||||
assert len(view._messages) == 1
|
||||
view._messages[0].setWordWrap(False)
|
||||
|
||||
height1 = view.sizeHint().height()
|
||||
assert height1 > 0
|
||||
|
|
@ -112,10 +117,14 @@ def test_rich_text(view, qtbot, rich, higher, expected_format, replace):
|
|||
assert view._messages[0].textFormat() == Qt.TextFormat.PlainText # default
|
||||
|
||||
view.show_message(info2)
|
||||
height2 = view.sizeHint().height()
|
||||
assert len(view._messages) == 1
|
||||
view._messages[0].setWordWrap(False)
|
||||
|
||||
height2 = view.sizeHint().height()
|
||||
assert height2 > 0
|
||||
|
||||
assert view._messages[0].textFormat() == expected_format
|
||||
|
||||
if higher:
|
||||
assert height2 > height1
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in New Issue