- // Test for "Filename"
- QTest::newRow("filename") << filename << text << QStringList();
- QTest::newRow("filename/empty") << "filename:" << "" << QStringList();
- QTest::newRow("filename/singleQuote") << "filename:\"" << "" << QStringList();
- QTest::newRow("filename/doubleQuote") << "filename:\"\"" << "" << QStringList();
+ const QString tag = QStringLiteral("tag:tagA");
+ const QString tagS = QStringLiteral("tag:\"tagB with spaces\""); // in search url
+ const QString tagR = QStringLiteral("tag:tagB with spaces"); // in result term
+
+ // Test for "Content"
+ QTest::newRow("content") << balooQueryUrl(text) << text << QStringList() << true << false;
+ QTest::newRow("content/space") << balooQueryUrl(textS) << textS << QStringList() << true << false;
+ QTest::newRow("content/quoted") << balooQueryUrl(textQ) << textS << QStringList() << true << false;
+ QTest::newRow("content/empty") << balooQueryUrl("") << "" << QStringList() << false << false;
+ QTest::newRow("content/single_quote") << balooQueryUrl("\"") << "\"" << QStringList() << true << false;
+ QTest::newRow("content/double_quote") << balooQueryUrl("\"\"") << "" << QStringList() << false << false;
+
+ // Test for "FileName"
+ QTest::newRow("filename") << balooQueryUrl(filename) << text << QStringList() << false << true;
+ QTest::newRow("filename/space") << balooQueryUrl(filenameS) << textS << QStringList() << false << true;
+ QTest::newRow("filename/quoted") << balooQueryUrl(filenameQ) << textQ << QStringList() << false << true;
+ QTest::newRow("filename/mixed") << balooQueryUrl(filenameM) << textM << QStringList() << false << true;
+ QTest::newRow("filename/empty") << balooQueryUrl("filename:") << "" << QStringList() << false << false;
+ QTest::newRow("filename/single_quote") << balooQueryUrl("filename:\"") << "\"" << QStringList() << false << true;
+ QTest::newRow("filename/double_quote") << balooQueryUrl("filename:\"\"") << "" << QStringList() << false << false;
+
+ // Combined content and filename search
+ QTest::newRow("content+filename")
+ << balooQueryUrl(text + " " + filename)
+ << text + " " + filename << QStringList() << true << true;
+
+ QTest::newRow("content+filename/quoted")
+ << balooQueryUrl(textQ + " " + filenameQ)
+ << textS + " " + filenameQ << QStringList() << true << true;