diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -71,7 +71,7 @@ ecm_add_test(draganddrophelpertest.cpp LINK_LIBRARIES dolphinprivate Qt5::Test) # PlacesItemModelTest -if (KIO_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 --- a/src/tests/placesitemmodeltest.cpp +++ b/src/tests/placesitemmodeltest.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include "dolphin_generalsettings.h" #include "panels/places/placesitemmodel.h" @@ -79,7 +80,7 @@ PlacesItemModel* m_model; QSet m_tobeRemoved; QMap m_interfacesMap; - int m_expectedModelCount = 14; + int m_expectedModelCount = KProtocolInfo::isKnownProtocol(QStringLiteral("recentlyused")) ? 15 : 14; bool m_hasDesktopFolder = false; bool m_hasDocumentsFolder = false; bool m_hasDownloadsFolder = false; @@ -175,8 +176,13 @@ urls << QStringLiteral("trash:/") << QStringLiteral("remote:/") - << QStringLiteral("/media/nfs") - << QStringLiteral("timeline:/today") << QStringLiteral("timeline:/yesterday") + << QStringLiteral("/media/nfs"); + + if (KProtocolInfo::isKnownProtocol(QStringLiteral("recentlyused"))) { + urls << QStringLiteral("recentlyused:/"); + } + + 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,15 +321,15 @@ 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")); - QCOMPARE(groups.at(3).first, expectedRemoteIndex + 4); + QCOMPARE(groups.at(3).first, expectedRemoteIndex + 5); QCOMPARE(groups.at(3).second.toString(), QStringLiteral("Search For")); - QCOMPARE(groups.at(4).first, expectedRemoteIndex + 8); + QCOMPARE(groups.at(4).first, expectedRemoteIndex + 9); QCOMPARE(groups.at(4).second.toString(), QStringLiteral("Devices")); - QCOMPARE(groups.at(5).first, expectedRemoteIndex + 9); + QCOMPARE(groups.at(5).first, expectedRemoteIndex + 10); QCOMPARE(groups.at(5).second.toString(), QStringLiteral("Removable Devices")); } @@ -342,7 +348,7 @@ 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;