mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-12-04 15:39:34 +01:00
Fix Auto-Type Empty Window Behavior
* Fixes #9282 * Also improve documentation for window title matching behavior
This commit is contained in:
@@ -125,6 +125,20 @@ void TestAutoType::init()
|
||||
m_entry5->setPassword("example5");
|
||||
m_entry5->setTitle("some title");
|
||||
m_entry5->setUrl("http://example.org");
|
||||
|
||||
m_entry6 = new Entry();
|
||||
m_entry6->setGroup(m_group);
|
||||
m_entry6->setPassword("example6");
|
||||
m_entry6->setTitle("empty window test");
|
||||
association.window = "";
|
||||
association.sequence = "{S:Empty Window}";
|
||||
m_entry6->autoTypeAssociations()->add(association);
|
||||
association.window = "non-matching window";
|
||||
association.sequence = "should not match";
|
||||
m_entry6->autoTypeAssociations()->add(association);
|
||||
association.window = "*notepad*";
|
||||
association.sequence = "{USERNAME}";
|
||||
m_entry6->autoTypeAssociations()->add(association);
|
||||
}
|
||||
|
||||
void TestAutoType::cleanup()
|
||||
@@ -446,3 +460,13 @@ void TestAutoType::testAutoTypeEffectiveSequences()
|
||||
QCOMPARE(entry6->defaultAutoTypeSequence(), sequenceOrphan);
|
||||
QCOMPARE(entry6->effectiveAutoTypeSequence(), QString());
|
||||
}
|
||||
|
||||
void TestAutoType::testAutoTypeEmptyWindowAssociation()
|
||||
{
|
||||
auto assoc = m_entry6->autoTypeSequences("Windows Notepad");
|
||||
QCOMPARE(assoc.size(), 2);
|
||||
QVERIFY(assoc.contains("{S:Empty Window}"));
|
||||
|
||||
assoc = m_entry6->autoTypeSequences("Some Other Window");
|
||||
QVERIFY(assoc.isEmpty());
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ private slots:
|
||||
void testAutoTypeResults_data();
|
||||
void testAutoTypeSyntaxChecks();
|
||||
void testAutoTypeEffectiveSequences();
|
||||
void testAutoTypeEmptyWindowAssociation();
|
||||
|
||||
private:
|
||||
AutoTypePlatformInterface* m_platform;
|
||||
@@ -64,6 +65,7 @@ private:
|
||||
Entry* m_entry3;
|
||||
Entry* m_entry4;
|
||||
Entry* m_entry5;
|
||||
Entry* m_entry6;
|
||||
};
|
||||
|
||||
#endif // KEEPASSX_TESTAUTOTYPE_H
|
||||
|
||||
Reference in New Issue
Block a user