mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-11-29 05:13:06 -08:00
Fix confusing behavior when leaving window title empty in Auto-Type
- Modified Entry::autoTypeSequences() to treat empty window titles as catch-all associations - Empty window title associations now match any window instead of being ignored - Added comprehensive test case to verify the new behavior - Fixes issue where empty window title associations only appeared during search Co-authored-by: droidmonkey <[email protected]>
This commit is contained in:
1 parent
aedd4ae08e
commit
2a931231c1
3 files changed
+38
-1
No files matched your search
@@ -125,6 +125,14 @@ void TestAutoType::init()
|
||||
m_entry5->setPassword("example5");
|
||||
m_entry5->setTitle("some title");
|
||||
m_entry5->setUrl("http://example.org");
|
||||
|
||||
// Entry with empty window title (should act as default/catch-all)
|
||||
m_entry6 = new Entry();
|
||||
m_entry6->setGroup(m_group);
|
||||
m_entry6->setPassword("empty_window_test");
|
||||
association.window = ""; // Empty window title
|
||||
association.sequence = "empty_window_sequence";
|
||||
m_entry6->autoTypeAssociations()->add(association);
|
||||
}
|
||||
|
||||
void TestAutoType::cleanup()
|
||||
@@ -280,6 +288,31 @@ void TestAutoType::testGlobalAutoTypeRegExp()
|
||||
m_test->clearActions();
|
||||
}
|
||||
|
||||
void TestAutoType::testGlobalAutoTypeEmptyWindow()
|
||||
{
|
||||
// Test that empty window title associations work as default/catch-all
|
||||
// This should match any window since the association has an empty window title
|
||||
m_test->setActiveWindowTitle("any random window title");
|
||||
emit osUtils->globalShortcutTriggered("autotype");
|
||||
m_autoType->performGlobalAutoType(m_dbList);
|
||||
QCOMPARE(m_test->actionChars(), QString("empty_window_sequence"));
|
||||
m_test->clearActions();
|
||||
|
||||
// Test with a different window title - should still match
|
||||
m_test->setActiveWindowTitle("completely different title");
|
||||
emit osUtils->globalShortcutTriggered("autotype");
|
||||
m_autoType->performGlobalAutoType(m_dbList);
|
||||
QCOMPARE(m_test->actionChars(), QString("empty_window_sequence"));
|
||||
m_test->clearActions();
|
||||
|
||||
// Test with empty window title - should still match
|
||||
m_test->setActiveWindowTitle("");
|
||||
emit osUtils->globalShortcutTriggered("autotype");
|
||||
m_autoType->performGlobalAutoType(m_dbList);
|
||||
QCOMPARE(m_test->actionChars(), QString("empty_window_sequence"));
|
||||
m_test->clearActions();
|
||||
}
|
||||
|
||||
void TestAutoType::testAutoTypeResults()
|
||||
{
|
||||
QScopedPointer<Entry> entry(new Entry());
|
||||
|
||||
Reference in new issue
Block a user