From 8e80c1d6dc1ede9b0a44ea1bd949487280c17064 Mon Sep 17 00:00:00 2001 From: Ismael Asensio Date: Sun, 15 Dec 2019 17:18:18 +0100 Subject: [dolphin/search] Search by (multiple) tags Summary: Adds a tag selector in the extended filters of the search box. Selected tag or tags are added to the search query along with the other filters (type, date, rating). FEATURE: 412564 CCBUG: 356062 Test Plan: - Menu shows the user tags - Picking any tag/s filters the search to that specific tag/s {F7727909} Reviewers: elvisangelaccio, ngraham, #dolphin, #vdg Reviewed By: elvisangelaccio, ngraham, #dolphin, #vdg Subscribers: kfm-devel Tags: #dolphin Maniphest Tasks: T9094 Differential Revision: https://phabricator.kde.org/D25130 --- src/tests/dolphinquerytest.cpp | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'src/tests/dolphinquerytest.cpp') diff --git a/src/tests/dolphinquerytest.cpp b/src/tests/dolphinquerytest.cpp index 1c6b39e26..e3c6fb8e3 100644 --- a/src/tests/dolphinquerytest.cpp +++ b/src/tests/dolphinquerytest.cpp @@ -45,6 +45,8 @@ void DolphinSearchBoxTest::testBalooSearchParsing_data() const QString filename = QStringLiteral("filename:\"xyz\""); const QString rating = QStringLiteral("rating>=2"); const QString modified = QString("modified>=2019-08-07"); + const QString tagA = QString("tag:tagA"); + const QString tagB = QString("tag:tagB"); QTest::addColumn("searchString"); QTest::addColumn("expectedText"); @@ -55,7 +57,8 @@ void DolphinSearchBoxTest::testBalooSearchParsing_data() QTest::newRow("content/empty") << "" << "" << QStringList(); QTest::newRow("content/singleQuote") << "\"" << "" << QStringList(); QTest::newRow("content/doubleQuote") << "\"\"" << "" << QStringList(); - // Test for empty `filename` + + // Test for "Filename" QTest::newRow("filename") << filename << text << QStringList(); QTest::newRow("filename/empty") << "filename:" << "" << QStringList(); QTest::newRow("filename/singleQuote") << "filename:\"" << "" << QStringList(); @@ -65,14 +68,34 @@ void DolphinSearchBoxTest::testBalooSearchParsing_data() QTest::newRow("rating") << rating << "" << QStringList({rating}); QTest::newRow("rating+content") << rating + " " + text << text << QStringList({rating}); QTest::newRow("rating+filename") << rating + " " + filename << text << QStringList({rating}); + // Test for modified date QTest::newRow("modified") << modified << "" << QStringList({modified}); QTest::newRow("modified+content") << modified + " " + text << text << QStringList({modified}); QTest::newRow("modified+filename") << modified + " " + filename << text << QStringList({modified}); + + // Test for tags + QTest::newRow("tag") << tagA << "" << QStringList({tagA}); + QTest::newRow("tag/double") << tagA + " " + tagB << "" << QStringList({tagA, tagB}); + QTest::newRow("tag+content") << tagA + " " + text << text << QStringList({tagA}); + QTest::newRow("tag+filename") << tagA + " " + filename << text << QStringList({tagA}); + // Combined tests - QTest::newRow("rating+modified") << rating + " AND " + modified << "" << QStringList({modified, rating}); - QTest::newRow("rating+modified+content") << rating + " AND " + modified + " " + text << text << QStringList({modified, rating}); - QTest::newRow("rating+modified+filename") << rating + " AND " + modified + " " + filename << text << QStringList({modified, rating}); + QTest::newRow("rating+modified") + << rating + " AND " + modified + << "" << QStringList({modified, rating}); + + QTest::newRow("allTerms") + << rating + " AND " + modified + " AND " + tagA + " AND " + tagB + << "" << QStringList({modified, rating, tagA, tagB}); + + QTest::newRow("allTerms+content") + << rating + " AND " + modified + " " + text + " " + tagA + " AND " + tagB + << text << QStringList({modified, rating, tagA, tagB}); + + QTest::newRow("allTerms+filename") + << rating + " AND " + modified + " " + filename + " " + tagA + " AND " + tagB + << text << QStringList({modified, rating, tagA, tagB}); } /** -- cgit v1.3