diff options
author | Florian Bruhin <me@the-compiler.org> | 2022-06-14 16:51:58 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2022-06-14 17:05:46 +0200 |
commit | 676e01677183825d19107d3b2fbf1bb2c0684ede (patch) | |
tree | a1ae1298c96b343decea1546cea05356c5545052 /tests/unit | |
parent | 1d7b89fd0038198548c0a335d2d8676e8c5e0d9d (diff) | |
download | qutebrowser-676e01677183825d19107d3b2fbf1bb2c0684ede.tar.gz qutebrowser-676e01677183825d19107d3b2fbf1bb2c0684ede.zip |
Only replace the exact same message
If we have a error message followed by an info message with the same text, they
should both be shown, not replaced automatically.
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/mainwindow/test_messageview.py | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/tests/unit/mainwindow/test_messageview.py b/tests/unit/mainwindow/test_messageview.py index 32bd638c7..5ba0e4ffc 100644 --- a/tests/unit/mainwindow/test_messageview.py +++ b/tests/unit/mainwindow/test_messageview.py @@ -122,11 +122,43 @@ def test_rich_text(view, qtbot, rich, higher, expected_format, replace): assert height2 == height1 -def test_show_message_twice(view): - """Show the same message twice -> only one should be shown.""" - view.show_message(message.MessageInfo(usertypes.MessageLevel.info, 'test')) - view.show_message(message.MessageInfo(usertypes.MessageLevel.info, 'test')) - assert len(view._messages) == 1 +@pytest.mark.parametrize("info1, info2, count", [ + # same + ( + message.MessageInfo(usertypes.MessageLevel.info, 'test'), + message.MessageInfo(usertypes.MessageLevel.info, 'test'), + 1, + ), + # different text + ( + message.MessageInfo(usertypes.MessageLevel.info, 'test'), + message.MessageInfo(usertypes.MessageLevel.info, 'test2'), + 2, + ), + # different level + ( + message.MessageInfo(usertypes.MessageLevel.info, 'test'), + message.MessageInfo(usertypes.MessageLevel.error, 'test'), + 2, + ), + # different rich text + ( + message.MessageInfo(usertypes.MessageLevel.info, 'test', rich=True), + message.MessageInfo(usertypes.MessageLevel.info, 'test', rich=False), + 2, + ), + # different replaces + ( + message.MessageInfo(usertypes.MessageLevel.info, 'test'), + message.MessageInfo(usertypes.MessageLevel.info, 'test', replace='test'), + 2, + ), +]) +def test_show_message_twice(view, info1, info2, count): + """Show the exact same message twice -> only one should be shown.""" + view.show_message(info1) + view.show_message(info2) + assert len(view._messages) == count def test_show_message_twice_after_first_disappears(qtbot, view): |