diff options
| author | Méven Car <[email protected]> | 2019-10-02 18:14:18 +0200 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2019-10-05 07:43:44 +0200 |
| commit | 8645ed68a15f28f37de78d0937c3a47718a7d436 (patch) | |
| tree | d197ae7410ff96db361e09f453debdad31c9fc9c | |
| parent | 3d65fa9a79593166f9dff25d9977b93d1be03a98 (diff) | |
Update dolphin tests following place changes D7446
Summary:
Adapt tests corresponding to changes in D7446
The placesitemmodeltest were not run due to KIO_VERSION not existing
Test Plan: LANG="en" ctest
Reviewers: #dolphin, elvisangelaccio
Reviewed By: #dolphin, elvisangelaccio
Subscribers: kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D23557
| -rw-r--r-- | src/tests/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/tests/placesitemmodeltest.cpp | 21 |
2 files changed, 17 insertions, 6 deletions
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 44a413bd9..6ecac1f1e 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -71,7 +71,7 @@ LINK_LIBRARIES dolphinprivate dolphinstatic Qt5::Test) ecm_add_test(draganddrophelpertest.cpp LINK_LIBRARIES dolphinprivate Qt5::Test) # PlacesItemModelTest -if (KF5_VERSION VERSION_GREATER_EQUAL "5.60.0") +if (KF5_VERSION VERSION_GREATER_EQUAL 5.63.0) ecm_add_test(placesitemmodeltest.cpp TEST_NAME placesitemmodeltest LINK_LIBRARIES dolphinprivate dolphinstatic Qt5::Test) diff --git a/src/tests/placesitemmodeltest.cpp b/src/tests/placesitemmodeltest.cpp index cc66c5aa0..d066b2ec9 100644 --- a/src/tests/placesitemmodeltest.cpp +++ b/src/tests/placesitemmodeltest.cpp @@ -28,6 +28,7 @@ #include <KConfigGroup> #include <KAboutData> #include <KFilePlacesModel> +#include <KProtocolInfo> #include "dolphin_generalsettings.h" #include "panels/places/placesitemmodel.h" @@ -79,7 +80,7 @@ private: PlacesItemModel* m_model; QSet<int> m_tobeRemoved; QMap<QString, QDBusInterface *> m_interfacesMap; - int m_expectedModelCount = 14; + int m_expectedModelCount = qEnvironmentVariableIsSet("KDE_FULL_SESSION") && KProtocolInfo::isKnownProtocol(QStringLiteral("recentlyused")) ? 16 : 14; bool m_hasDesktopFolder = false; bool m_hasDocumentsFolder = false; bool m_hasDownloadsFolder = false; @@ -175,8 +176,14 @@ QStringList PlacesItemModelTest::initialUrls() const urls << QStringLiteral("trash:/") << QStringLiteral("remote:/") - << QStringLiteral("/media/nfs") - << QStringLiteral("timeline:/today") << QStringLiteral("timeline:/yesterday") + << QStringLiteral("/media/nfs"); + + if (qEnvironmentVariableIsSet("KDE_FULL_SESSION") && KProtocolInfo::isKnownProtocol(QStringLiteral("recentlyused"))) { + urls << QStringLiteral("recentlyused:/files"); + urls << QStringLiteral("recentlyused:/locations"); + } + + urls << QStringLiteral("timeline:/today") << QStringLiteral("timeline:/yesterday") << QStringLiteral("search:/documents") << QStringLiteral("search:/images") << QStringLiteral("search:/audio") << QStringLiteral("search:/videos") << QStringLiteral("/foreign") << QStringLiteral("/media/floppy0") << QStringLiteral("/media/XO-Y4") << QStringLiteral("/media/cdrom"); @@ -315,7 +322,11 @@ void PlacesItemModelTest::testGroups() QCOMPARE(groups.at(1).second.toString(), QStringLiteral("Remote")); QCOMPARE(groups.at(2).first, expectedRemoteIndex + 2); - QCOMPARE(groups.at(2).second.toString(), QStringLiteral("Recently Saved")); + QCOMPARE(groups.at(2).second.toString(), QStringLiteral("Recent")); + + if (qEnvironmentVariableIsSet("KDE_FULL_SESSION") && KProtocolInfo::isKnownProtocol(QStringLiteral("recentlyused"))) { + expectedRemoteIndex += 2; + } QCOMPARE(groups.at(3).first, expectedRemoteIndex + 4); QCOMPARE(groups.at(3).second.toString(), QStringLiteral("Search For")); @@ -342,7 +353,7 @@ void PlacesItemModelTest::testPlaceItem_data() QTest::newRow("Baloo - Documents") << QUrl("search:/documents") << false << true << QStringLiteral("Search For") << false; // baloo - timeline - QTest::newRow("Baloo - Today") << QUrl("timeline:/today") << false << true << QStringLiteral("Recently Saved") << false; + QTest::newRow("Baloo - Today") << QUrl("timeline:/today") << false << true << QStringLiteral("Recent") << false; // devices QTest::newRow("Devices - Floppy") << QUrl("file:///media/floppy0") << false << false << QStringLiteral("Removable Devices") << false; |
