From ffb80cb00d8fd886051f970b5155a55b1d066fcd Mon Sep 17 00:00:00 2001 From: Elvis Angelaccio Date: Sat, 13 Mar 2021 17:18:53 +0100 Subject: [PATCH] Enable test mode in all test --- src/tests/dolphinquerytest.cpp | 7 +++++++ src/tests/dolphinsearchboxtest.cpp | 7 +++++++ src/tests/draganddrophelpertest.cpp | 7 +++++++ src/tests/kfileitemlistviewtest.cpp | 7 +++++++ src/tests/kfileitemmodelbenchmark.cpp | 7 +++++++ src/tests/kfileitemmodeltest.cpp | 7 +++++++ src/tests/kitemlistcontrollertest.cpp | 2 ++ src/tests/kitemlistkeyboardsearchmanagertest.cpp | 7 +++++++ src/tests/kitemlistselectionmanagertest.cpp | 7 +++++++ src/tests/kitemrangetest.cpp | 7 +++++++ src/tests/kitemsettest.cpp | 3 +++ src/tests/kstandarditemmodeltest.cpp | 7 +++++++ src/tests/viewpropertiestest.cpp | 6 ++++++ 13 files changed, 81 insertions(+) diff --git a/src/tests/dolphinquerytest.cpp b/src/tests/dolphinquerytest.cpp index dfee3dbd5..d0a590233 100644 --- a/src/tests/dolphinquerytest.cpp +++ b/src/tests/dolphinquerytest.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -19,6 +20,7 @@ class DolphinSearchBoxTest : public QObject Q_OBJECT private Q_SLOTS: + void initTestCase(); void testBalooSearchParsing_data(); void testBalooSearchParsing(); }; @@ -45,6 +47,11 @@ QUrl balooQueryUrl(const QString& searchString) return searchUrl; } +void DolphinSearchBoxTest::initTestCase() +{ + QStandardPaths::setTestModeEnabled(true); +} + /** * Defines the parameters for the test cases in testBalooSearchParsing() */ diff --git a/src/tests/dolphinsearchboxtest.cpp b/src/tests/dolphinsearchboxtest.cpp index 0a2113fac..56420e56e 100644 --- a/src/tests/dolphinsearchboxtest.cpp +++ b/src/tests/dolphinsearchboxtest.cpp @@ -6,6 +6,7 @@ #include "search/dolphinsearchbox.h" +#include #include class DolphinSearchBoxTest : public QObject @@ -13,6 +14,7 @@ class DolphinSearchBoxTest : public QObject Q_OBJECT private Q_SLOTS: + void initTestCase(); void init(); void cleanup(); @@ -22,6 +24,11 @@ private: DolphinSearchBox* m_searchBox; }; +void DolphinSearchBoxTest::initTestCase() +{ + QStandardPaths::setTestModeEnabled(true); +} + void DolphinSearchBoxTest::init() { m_searchBox = new DolphinSearchBox(); diff --git a/src/tests/draganddrophelpertest.cpp b/src/tests/draganddrophelpertest.cpp index 9379347f0..a82e75c7b 100644 --- a/src/tests/draganddrophelpertest.cpp +++ b/src/tests/draganddrophelpertest.cpp @@ -4,6 +4,7 @@ * SPDX-License-Identifier: GPL-2.0-or-later */ +#include #include #include @@ -12,10 +13,16 @@ class DragAndDropHelperTest : public QObject Q_OBJECT private Q_SLOTS: + void initTestCase(); void testUrlListMatchesUrl_data(); void testUrlListMatchesUrl(); }; +void DragAndDropHelperTest::initTestCase() +{ + QStandardPaths::setTestModeEnabled(true); +} + void DragAndDropHelperTest::testUrlListMatchesUrl_data() { QTest::addColumn>("urlList"); diff --git a/src/tests/kfileitemlistviewtest.cpp b/src/tests/kfileitemlistviewtest.cpp index 2aa9941c7..4a5cd0630 100644 --- a/src/tests/kfileitemlistviewtest.cpp +++ b/src/tests/kfileitemlistviewtest.cpp @@ -12,12 +12,14 @@ #include #include #include +#include class KFileItemListViewTest : public QObject { Q_OBJECT private Q_SLOTS: + void initTestCase(); void init(); void cleanup(); void testGroupedItemChanges(); @@ -29,6 +31,11 @@ private: QGraphicsView* m_graphicsView; }; +void KFileItemListViewTest::initTestCase() +{ + QStandardPaths::setTestModeEnabled(true); +} + void KFileItemListViewTest::init() { qRegisterMetaType("KItemRangeList"); diff --git a/src/tests/kfileitemmodelbenchmark.cpp b/src/tests/kfileitemmodelbenchmark.cpp index 5c44a354f..8e307e2a1 100644 --- a/src/tests/kfileitemmodelbenchmark.cpp +++ b/src/tests/kfileitemmodelbenchmark.cpp @@ -7,6 +7,7 @@ #include #include +#include #include @@ -44,6 +45,7 @@ public: KFileItemModelBenchmark(); private Q_SLOTS: + void initTestCase(); void insertAndRemoveManyItems_data(); void insertAndRemoveManyItems(); @@ -55,6 +57,11 @@ KFileItemModelBenchmark::KFileItemModelBenchmark() { } +void KFileItemModelBenchmark::initTestCase() +{ + QStandardPaths::setTestModeEnabled(true); +} + void KFileItemModelBenchmark::insertAndRemoveManyItems_data() { QTest::addColumn("initialItems"); diff --git a/src/tests/kfileitemmodeltest.cpp b/src/tests/kfileitemmodeltest.cpp index bf3ce8aed..558a00ab5 100644 --- a/src/tests/kfileitemmodeltest.cpp +++ b/src/tests/kfileitemmodeltest.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -47,6 +48,7 @@ class KFileItemModelTest : public QObject private Q_SLOTS: void init(); + void initTestCase(); void cleanup(); void testDefaultRoles(); @@ -93,6 +95,11 @@ private: TestDir* m_testDir; }; +void KFileItemModelTest::initTestCase() +{ + QStandardPaths::setTestModeEnabled(true); +} + void KFileItemModelTest::init() { // The item-model tests result in a huge number of debugging diff --git a/src/tests/kitemlistcontrollertest.cpp b/src/tests/kitemlistcontrollertest.cpp index eb938728d..4149a4d85 100644 --- a/src/tests/kitemlistcontrollertest.cpp +++ b/src/tests/kitemlistcontrollertest.cpp @@ -16,6 +16,7 @@ #include #include #include +#include /** * \class KItemListControllerTestStyle is a proxy style for testing the @@ -103,6 +104,7 @@ private: */ void KItemListControllerTest::initTestCase() { + QStandardPaths::setTestModeEnabled(true); qRegisterMetaType("KItemSet"); m_testDir = new TestDir(); diff --git a/src/tests/kitemlistkeyboardsearchmanagertest.cpp b/src/tests/kitemlistkeyboardsearchmanagertest.cpp index 2005c9cca..686f98b51 100644 --- a/src/tests/kitemlistkeyboardsearchmanagertest.cpp +++ b/src/tests/kitemlistkeyboardsearchmanagertest.cpp @@ -8,12 +8,14 @@ #include #include +#include class KItemListKeyboardSearchManagerTest : public QObject { Q_OBJECT private Q_SLOTS: + void initTestCase(); void init(); void testBasicKeyboardSearch(); @@ -25,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 diff --git a/src/tests/kitemlistselectionmanagertest.cpp b/src/tests/kitemlistselectionmanagertest.cpp index b1e3f54f8..7f87fdcc8 100644 --- a/src/tests/kitemlistselectionmanagertest.cpp +++ b/src/tests/kitemlistselectionmanagertest.cpp @@ -10,6 +10,7 @@ #include #include +#include class DummyModel : public KItemModelBase { @@ -52,6 +53,7 @@ class KItemListSelectionManagerTest : public QObject Q_OBJECT private Q_SLOTS: + void initTestCase(); void init(); void cleanup(); @@ -76,6 +78,11 @@ private: DummyModel* m_model; }; +void KItemListSelectionManagerTest::initTestCase() +{ + QStandardPaths::setTestModeEnabled(true); +} + void KItemListSelectionManagerTest::init() { m_model = new DummyModel(); diff --git a/src/tests/kitemrangetest.cpp b/src/tests/kitemrangetest.cpp index 2ebca2308..c782acee7 100644 --- a/src/tests/kitemrangetest.cpp +++ b/src/tests/kitemrangetest.cpp @@ -6,6 +6,7 @@ #include "kitemviews/kitemrange.h" +#include #include Q_DECLARE_METATYPE(QVector) @@ -16,10 +17,16 @@ class KItemRangeTest : public QObject Q_OBJECT private Q_SLOTS: + void initTestCase(); void testFromSortedContainer_data(); void testFromSortedContainer(); }; +void KItemRangeTest::initTestCase() +{ + QStandardPaths::setTestModeEnabled(true); +} + void KItemRangeTest::testFromSortedContainer_data() { QTest::addColumn >("sortedNumbers"); diff --git a/src/tests/kitemsettest.cpp b/src/tests/kitemsettest.cpp index 9b40e150d..b5e0a82cd 100644 --- a/src/tests/kitemsettest.cpp +++ b/src/tests/kitemsettest.cpp @@ -6,6 +6,7 @@ #include "kitemviews/kitemset.h" +#include #include Q_DECLARE_METATYPE(KItemRangeList) @@ -110,6 +111,8 @@ private: void KItemSetTest::initTestCase() { + QStandardPaths::setTestModeEnabled(true); + m_testCases.insert("empty", KItemRangeList()); m_testCases.insert("[0]", KItemRangeList() << KItemRange(0, 1)); m_testCases.insert("[1]", KItemRangeList() << KItemRange(1, 1)); diff --git a/src/tests/kstandarditemmodeltest.cpp b/src/tests/kstandarditemmodeltest.cpp index c04e71524..943a85214 100644 --- a/src/tests/kstandarditemmodeltest.cpp +++ b/src/tests/kstandarditemmodeltest.cpp @@ -10,6 +10,7 @@ #include "kitemviews/kstandarditem.h" #include "kitemviews/kstandarditemmodel.h" +#include #include class KStandardItemModelTest : public QObject @@ -17,6 +18,7 @@ class KStandardItemModelTest : public QObject Q_OBJECT private Q_SLOTS: + void initTestCase(); void init(); void cleanup(); @@ -30,6 +32,11 @@ private: KStandardItemModel* m_model; }; +void KStandardItemModelTest::initTestCase() +{ + QStandardPaths::setTestModeEnabled(true); +} + void KStandardItemModelTest::init() { m_model = new KStandardItemModel(); diff --git a/src/tests/viewpropertiestest.cpp b/src/tests/viewpropertiestest.cpp index fb3023db5..14d59be0a 100644 --- a/src/tests/viewpropertiestest.cpp +++ b/src/tests/viewpropertiestest.cpp @@ -15,6 +15,7 @@ class ViewPropertiesTest : public QObject Q_OBJECT private Q_SLOTS: + void initTestCase(); void init(); void cleanup(); @@ -26,6 +27,11 @@ private: TestDir* m_testDir; }; +void ViewPropertiesTest::initTestCase() +{ + QStandardPaths::setTestModeEnabled(true); +} + void ViewPropertiesTest::init() { m_globalViewProps = GeneralSettings::self()->globalViewProps();