def keyhint(qtbot, config_stub, key_config_stub): """Fixture to initialize a KeyHintView.""" config_stub.val.colors.keyhint.suffix.fg = 'yellow' keyhint = KeyHintView(0, None) qtbot.add_widget(keyhint) assert keyhint.text() == '' return keyhint
def test_delay(qtbot, stubs, monkeypatch, keyhint_config, key_config_stub): timer = stubs.FakeTimer() monkeypatch.setattr('qutebrowser.misc.keyhintwidget.usertypes.Timer', lambda *_: timer) interval = 200 keyhint_config.set('ui', 'keyhint-delay', interval) key_config_stub.set_bindings_for('normal', OrderedDict([('aa', 'cmd-aa')])) keyhint = KeyHintView(0, None) keyhint.update_keyhint('normal', 'a') assert timer.interval() == interval
def test_delay(qtbot, stubs, monkeypatch, config_stub, key_config_stub): timer = stubs.FakeTimer() monkeypatch.setattr('qutebrowser.misc.keyhintwidget.usertypes.Timer', lambda *_: timer) interval = 200 bindings = {'normal': {'aa': 'message-info cmd-aa'}} config_stub.val.keyhint.delay = interval config_stub.val.bindings.default = {} config_stub.val.bindings.commands = bindings keyhint = KeyHintView(0, None) keyhint.update_keyhint('normal', 'a') assert timer.interval() == interval
def keyhint(qtbot, config_stub, key_config_stub): """Fixture to initialize a KeyHintView.""" config_stub.data = { 'colors': { 'keyhint.fg': 'white', 'keyhint.fg.suffix': 'yellow', 'keyhint.bg': 'black' }, 'fonts': {'keyhint': 'Comic Sans'}, 'ui': {'keyhint-blacklist': '', 'status-position': 'bottom'}, } keyhint = KeyHintView(0, None) qtbot.add_widget(keyhint) assert keyhint.text() == '' return keyhint
def keyhint(qtbot, keyhint_config, key_config_stub): """Fixture to initialize a KeyHintView.""" keyhint = KeyHintView(0, None) qtbot.add_widget(keyhint) assert keyhint.text() == '' return keyhint