#include "kitemviews/private/kitemlistkeyboardsearchmanager.h"
-#include <QTest>
#include <QSignalSpy>
+#include <QStandardPaths>
+#include <QTest>
class KItemListKeyboardSearchManagerTest : public QObject
{
Q_OBJECT
-private slots:
+private Q_SLOTS:
+ void initTestCase();
void init();
void testBasicKeyboardSearch();
KItemListKeyboardSearchManager m_keyboardSearchManager;
};
+void KItemListKeyboardSearchManagerTest::initTestCase()
+{
+ QStandardPaths::setTestModeEnabled(true);
+}
+
void KItemListKeyboardSearchManagerTest::init()
{
// Make sure that the previous search string is cleared
m_keyboardSearchManager.addKeys("f");
QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.takeFirst(), QList<QVariant>() << "f" << false);
+ QCOMPARE(spy.takeFirst(), QList<QVariant>() << "f" << true);
m_keyboardSearchManager.addKeys("i");
QCOMPARE(spy.count(), 1);
m_keyboardSearchManager.addKeys("f");
QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.takeFirst(), QList<QVariant>() << "f" << false);
+ QCOMPARE(spy.takeFirst(), QList<QVariant>() << "f" << true);
m_keyboardSearchManager.addKeys("i");
QCOMPARE(spy.count(), 1);
m_keyboardSearchManager.addKeys("a");
QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.takeFirst(), QList<QVariant>() << "a" << false);
+ QCOMPARE(spy.takeFirst(), QList<QVariant>() << "a" << true);
}
void KItemListKeyboardSearchManagerTest::testRepeatedKeyPress()
m_keyboardSearchManager.addKeys("p");
QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.takeFirst(), QList<QVariant>() << "p" << false);
+ QCOMPARE(spy.takeFirst(), QList<QVariant>() << "p" << true);
m_keyboardSearchManager.addKeys("p");
QCOMPARE(spy.count(), 1);
// Simulate that the user enters "a_b".
m_keyboardSearchManager.addKeys("a");
QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.takeFirst(), QList<QVariant>() << "a" << false);
+ QCOMPARE(spy.takeFirst(), QList<QVariant>() << "a" << true);
m_keyboardSearchManager.addKeys("");
QCOMPARE(spy.count(), 0);