Improve keyhint tests

This also brings them back to 100% coverage
This commit is contained in:
Florian Bruhin 2016-09-25 16:42:13 +02:00
parent 02accf3e71
commit ab7cbfdea0

View File

@ -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