]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/tests/kitemlistkeyboardsearchmanagertest.cpp
Prepare view-engine for non-KFileItem usecase
[dolphin.git] / src / tests / kitemlistkeyboardsearchmanagertest.cpp
index 14a09a31cc82b89737bbad61c1bd1695ed922cd8..cf15324e2789fa3e292c9c29a99aa46797c0158e 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <qtest_kde.h>
 
-#include "kitemviews/kitemlistkeyboardsearchmanager_p.h"
+#include "kitemviews/private/kitemlistkeyboardsearchmanager.h"
 
 class KItemListKeyboardSearchManagerTest : public QObject
 {
@@ -65,6 +65,10 @@ void KItemListKeyboardSearchManagerTest::testBasicKeyboardSearch()
 
 void KItemListKeyboardSearchManagerTest::testAbortedKeyboardSearch()
 {
+    // Set the timeout to a small value (the default is 5000 milliseconds)
+    // to save time when running this test.
+    m_keyboardSearchManager.setTimeout(100);
+
     QSignalSpy spy(&m_keyboardSearchManager, SIGNAL(changeCurrentItem(QString,bool)));
 
     m_keyboardSearchManager.addKeys("f");
@@ -75,9 +79,9 @@ void KItemListKeyboardSearchManagerTest::testAbortedKeyboardSearch()
     QCOMPARE(spy.count(), 1);
     QCOMPARE(spy.takeFirst(), QList<QVariant>() << "fi" << false);
 
-    // If the delay between two key presses is larger than 5000 milliseconds,
+    // If the delay between two key presses is larger than the chosen timeout,
     // a new search is started. We add a small safety margin to avoid race conditions.
-    QTest::qWait(5000 + 10);
+    QTest::qWait(m_keyboardSearchManager.timeout() + 10);
 
     m_keyboardSearchManager.addKeys("l");
     QCOMPARE(spy.count(), 1);