┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorIsmael Asensio <[email protected]>2019-12-15 17:18:18 +0100
committerIsmael Asensio <[email protected]>2019-12-15 17:28:38 +0100
commit8e80c1d6dc1ede9b0a44ea1bd949487280c17064 (patch)
tree5d1008fdb62741e49a1b1daeda0d078ffa72bf92 /src/tests
parentf6229562088487a7694c644be14d77f21d21c762 (diff)
[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
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/dolphinquerytest.cpp31
1 files changed, 27 insertions, 4 deletions
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<QString>("searchString");
QTest::addColumn<QString>("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});
}
/**