diff options
| author | Méven Car <[email protected]> | 2019-10-26 12:53:04 +0200 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2019-10-26 12:53:34 +0200 |
| commit | a5ce798f282b6cf9e153bba89f9caea0cec37da0 (patch) | |
| tree | 818304092ce30546b7d6fc126ed471e9f7b5fd57 /src/tests/kitemlistkeyboardsearchmanagertest.cpp | |
| parent | d8c11a67bd98820fd2c9a4b616460857af70344b (diff) | |
When the selection is deselected, restart the keyboard search from the beginning
Summary:
BUG: 411538
FIXED-IN: 19.12
Test Plan:
Open a directory with 3 files starting with the same letter.
1. Press this letter key twice
2. The second file is selected
3. Deselect the file with the mouse or using Esc
4. Wait 1 second
5. Press the same key again
Before:
The third file gets selected
After:
The first file get selected
ctest
Reviewers: #dolphin, elvisangelaccio, ngraham
Reviewed By: #dolphin, elvisangelaccio, ngraham
Subscribers: ngraham, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D23716
Diffstat (limited to 'src/tests/kitemlistkeyboardsearchmanagertest.cpp')
| -rw-r--r-- | src/tests/kitemlistkeyboardsearchmanagertest.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/tests/kitemlistkeyboardsearchmanagertest.cpp b/src/tests/kitemlistkeyboardsearchmanagertest.cpp index c14ce87ac..53ef9ec3c 100644 --- a/src/tests/kitemlistkeyboardsearchmanagertest.cpp +++ b/src/tests/kitemlistkeyboardsearchmanagertest.cpp @@ -51,7 +51,7 @@ void KItemListKeyboardSearchManagerTest::testBasicKeyboardSearch() m_keyboardSearchManager.addKeys("f"); QCOMPARE(spy.count(), 1); - QCOMPARE(spy.takeFirst(), QList<QVariant>() << "f" << true); + QCOMPARE(spy.takeFirst(), QList<QVariant>() << "f" << false); m_keyboardSearchManager.addKeys("i"); QCOMPARE(spy.count(), 1); @@ -77,7 +77,7 @@ void KItemListKeyboardSearchManagerTest::testAbortedKeyboardSearch() m_keyboardSearchManager.addKeys("f"); QCOMPARE(spy.count(), 1); - QCOMPARE(spy.takeFirst(), QList<QVariant>() << "f" << true); + QCOMPARE(spy.takeFirst(), QList<QVariant>() << "f" << false); m_keyboardSearchManager.addKeys("i"); QCOMPARE(spy.count(), 1); @@ -94,6 +94,13 @@ void KItemListKeyboardSearchManagerTest::testAbortedKeyboardSearch() m_keyboardSearchManager.addKeys("e"); QCOMPARE(spy.count(), 1); QCOMPARE(spy.takeFirst(), QList<QVariant>() << "le" << false); + + // the selection was deselected, for instance with Esc or a click outside the selection + m_keyboardSearchManager.slotSelectionChanged(KItemSet(), KItemSet() << 1); + + m_keyboardSearchManager.addKeys("a"); + QCOMPARE(spy.count(), 1); + QCOMPARE(spy.takeFirst(), QList<QVariant>() << "a" << false); } void KItemListKeyboardSearchManagerTest::testRepeatedKeyPress() @@ -109,7 +116,7 @@ void KItemListKeyboardSearchManagerTest::testRepeatedKeyPress() m_keyboardSearchManager.addKeys("p"); QCOMPARE(spy.count(), 1); - QCOMPARE(spy.takeFirst(), QList<QVariant>() << "p" << true); + QCOMPARE(spy.takeFirst(), QList<QVariant>() << "p" << false); m_keyboardSearchManager.addKeys("p"); QCOMPARE(spy.count(), 1); @@ -138,7 +145,7 @@ void KItemListKeyboardSearchManagerTest::testPressShift() // Simulate that the user enters "a_b". m_keyboardSearchManager.addKeys("a"); QCOMPARE(spy.count(), 1); - QCOMPARE(spy.takeFirst(), QList<QVariant>() << "a" << true); + QCOMPARE(spy.takeFirst(), QList<QVariant>() << "a" << false); m_keyboardSearchManager.addKeys(""); QCOMPARE(spy.count(), 0); |
