]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/tests/kitemlistkeyboardsearchmanagertest.cpp
GIT_SILENT Sync po/docbooks with svn
[dolphin.git] / src / tests / kitemlistkeyboardsearchmanagertest.cpp
index 53ef9ec3cac349d1baba9d14ddae401b00adac5b..bbdb9c397f491ea0b1c5fe44a365f5444dc1ba0b 100644 (file)
@@ -1,32 +1,21 @@
-/***************************************************************************
- *   Copyright (C) 2011 by Frank Reininghaus <frank78ac@googlemail.com>    *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- *   This program is distributed in the hope that it will be useful,       *
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
- *   GNU General Public License for more details.                          *
- *                                                                         *
- *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
- ***************************************************************************/
+/*
+ *   SPDX-FileCopyrightText: 2011 Frank Reininghaus <frank78ac@googlemail.com>
+ *
+ *   SPDX-License-Identifier: GPL-2.0-or-later
+ */
 
 #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();
@@ -38,6 +27,11 @@ private:
     KItemListKeyboardSearchManager m_keyboardSearchManager;
 };
 
+void KItemListKeyboardSearchManagerTest::initTestCase()
+{
+    QStandardPaths::setTestModeEnabled(true);
+}
+
 void KItemListKeyboardSearchManagerTest::init()
 {
     // Make sure that the previous search string is cleared
@@ -51,7 +45,7 @@ void KItemListKeyboardSearchManagerTest::testBasicKeyboardSearch()
 
     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);
@@ -77,7 +71,7 @@ void KItemListKeyboardSearchManagerTest::testAbortedKeyboardSearch()
 
     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);
@@ -100,7 +94,7 @@ void KItemListKeyboardSearchManagerTest::testAbortedKeyboardSearch()
 
     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()
@@ -116,7 +110,7 @@ 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);
@@ -145,7 +139,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" << false);
+    QCOMPARE(spy.takeFirst(), QList<QVariant>() << "a" << true);
 
     m_keyboardSearchManager.addKeys("");
     QCOMPARE(spy.count(), 0);