Show the keystring correctly when entering a count

This commit is contained in:
Florian Bruhin 2018-03-07 22:47:31 +01:00
parent 514138aad2
commit 9b9d7647a4
2 changed files with 9 additions and 0 deletions

View File

@ -166,6 +166,7 @@ class BaseKeyParser(QObject):
assert len(txt) == 1, txt
if not dry_run:
self._count += txt
self.keystring_updated.emit(self._count + str(self._sequence))
return QKeySequence.ExactMatch
if dry_run:

View File

@ -281,6 +281,14 @@ class TestCount:
keyparser.execute.assert_called_once_with('message-info ccc', 23)
assert not keyparser._sequence
def test_count_keystring_update(self, qtbot, handle_text, keyparser):
"""Make sure the keystring is updated correctly when entering count."""
with qtbot.waitSignals([keyparser.keystring_updated, keyparser.keystring_updated]) as blocker:
handle_text(Qt.Key_4, Qt.Key_2)
sig1, sig2 = blocker.all_signals_and_args
assert sig1.args == ('4',)
assert sig2.args == ('42',)
def test_clear_keystring(qtbot, keyparser):
"""Test that the keystring is cleared and the signal is emitted."""