From ab7cbfdea0d4832ad1f28d2e3050c4c1dd00bcd2 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sun, 25 Sep 2016 16:42:13 +0200 Subject: [PATCH] Improve keyhint tests This also brings them back to 100% coverage --- tests/unit/misc/test_keyhints.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/unit/misc/test_keyhints.py b/tests/unit/misc/test_keyhints.py index 8621610d2..aeef3bee5 100644 --- a/tests/unit/misc/test_keyhints.py +++ b/tests/unit/misc/test_keyhints.py @@ -61,6 +61,21 @@ def keyhint(qtbot, config_stub, key_config_stub): return keyhint +def test_show_and_hide(qtbot, keyhint): + with qtbot.waitSignal(keyhint.update_geometry): + keyhint.show() + qtbot.waitForWindowShown(keyhint) + keyhint.update_keyhint('normal', '') + assert not keyhint.isVisible() + + +def test_position_change(keyhint, config_stub): + config_stub.set('ui', 'status-position', 'top') + stylesheet = keyhint.styleSheet() + assert 'border-bottom-right-radius' in stylesheet + assert 'border-top-right-radius' not in stylesheet + + def test_suggestions(keyhint, key_config_stub): """Test that keyhints are shown based on a prefix.""" # we want the dict to return sorted items() for reliable testing