mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
add test case for recursive placeholders
This commit is contained in:
parent
18628612b2
commit
10170a555e
@ -796,7 +796,7 @@ QString Entry::resolvePlaceholderRecursive(const QString& placeholder, int maxDe
|
|||||||
switch (typeOfPlaceholder) {
|
switch (typeOfPlaceholder) {
|
||||||
case PlaceholderType::NotPlaceholder:
|
case PlaceholderType::NotPlaceholder:
|
||||||
case PlaceholderType::Unknown:
|
case PlaceholderType::Unknown:
|
||||||
return placeholder;
|
return resolveMultiplePlaceholdersRecursive(placeholder, maxDepth - 1);
|
||||||
case PlaceholderType::Title:
|
case PlaceholderType::Title:
|
||||||
if (placeholderType(title()) == PlaceholderType::Title) {
|
if (placeholderType(title()) == PlaceholderType::Title) {
|
||||||
return title();
|
return title();
|
||||||
|
@ -279,6 +279,17 @@ void TestEntry::testResolveRecursivePlaceholders()
|
|||||||
QCOMPARE(entry6->resolvePlaceholder(entry6->title()), QString("Entry2Title"));
|
QCOMPARE(entry6->resolvePlaceholder(entry6->title()), QString("Entry2Title"));
|
||||||
QCOMPARE(entry6->resolvePlaceholder(entry6->username()), QString("Entry2Title"));
|
QCOMPARE(entry6->resolvePlaceholder(entry6->username()), QString("Entry2Title"));
|
||||||
QCOMPARE(entry6->resolvePlaceholder(entry6->password()), QString("{PASSWORD}"));
|
QCOMPARE(entry6->resolvePlaceholder(entry6->password()), QString("{PASSWORD}"));
|
||||||
|
|
||||||
|
auto* entry7 = new Entry();
|
||||||
|
entry7->setGroup(root);
|
||||||
|
entry7->setUuid(Uuid::random());
|
||||||
|
entry7->setTitle(QString("{REF:T@I:%1} and something else").arg(entry3->uuid().toHex()));
|
||||||
|
entry7->setUsername(QString("{TITLE}"));
|
||||||
|
entry7->setPassword(QString("PASSWORD"));
|
||||||
|
|
||||||
|
QCOMPARE(entry7->resolvePlaceholder(entry7->title()), QString("Entry2Title and something else"));
|
||||||
|
QCOMPARE(entry7->resolvePlaceholder(entry7->username()), QString("Entry2Title and something else"));
|
||||||
|
QCOMPARE(entry7->resolvePlaceholder(entry7->password()), QString("PASSWORD"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestEntry::testResolveReferencePlaceholders()
|
void TestEntry::testResolveReferencePlaceholders()
|
||||||
|
Loading…
Reference in New Issue
Block a user