mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-06 13:34:16 -04:00
Whitespace separated search terms are AND concatenated.
This commit is contained in:
parent
4d263a09db
commit
92bf7c94d0
4 changed files with 48 additions and 4 deletions
|
@ -399,4 +399,35 @@ void TestGroup::testSearch()
|
|||
delete groupRoot;
|
||||
}
|
||||
|
||||
void TestGroup::testAndConcatenationInSearch()
|
||||
{
|
||||
Group* group = new Group();
|
||||
Entry* entry = new Entry();
|
||||
entry->setNotes("abc def ghi");
|
||||
entry->setTitle("jkl");
|
||||
entry->setGroup(group);
|
||||
|
||||
QList<Entry*> searchResult;
|
||||
|
||||
searchResult = group->search("", Qt::CaseInsensitive);
|
||||
QCOMPARE(searchResult.count(), 1);
|
||||
|
||||
searchResult = group->search("def", Qt::CaseInsensitive);
|
||||
QCOMPARE(searchResult.count(), 1);
|
||||
|
||||
searchResult = group->search(" abc ghi ", Qt::CaseInsensitive);
|
||||
QCOMPARE(searchResult.count(), 1);
|
||||
|
||||
searchResult = group->search("ghi ef", Qt::CaseInsensitive);
|
||||
QCOMPARE(searchResult.count(), 1);
|
||||
|
||||
searchResult = group->search("abc ef xyz", Qt::CaseInsensitive);
|
||||
QCOMPARE(searchResult.count(), 0);
|
||||
|
||||
searchResult = group->search("abc kl", Qt::CaseInsensitive);
|
||||
QCOMPARE(searchResult.count(), 1);
|
||||
|
||||
delete group;
|
||||
}
|
||||
|
||||
QTEST_GUILESS_MAIN(TestGroup)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue