]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Update dolphin tests following place changes D7446
authorMéven Car <meven29@gmail.com>
Wed, 2 Oct 2019 16:14:18 +0000 (18:14 +0200)
committerMéven Car <meven29@gmail.com>
Sat, 5 Oct 2019 05:43:44 +0000 (07:43 +0200)
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

src/tests/CMakeLists.txt
src/tests/placesitemmodeltest.cpp

index 44a413bd934655e363c1ec5c1f02c5f57e91c724..6ecac1f1e8b431e15abc4aef8e354df448a21006 100644 (file)
@@ -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)
index cc66c5aa0de2087f24fad6c682fa0a7d9dd04d35..d066b2ec907ffda80f6a02b2cece3c461954f889 100644 (file)
@@ -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;