mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-05-02 14:46:07 -04:00
More auto-type tests.
This commit is contained in:
parent
848abfc1a7
commit
8347fd36ba
4 changed files with 46 additions and 1 deletions
|
@ -52,13 +52,20 @@ void TestAutoType::init()
|
|||
{
|
||||
m_test->clearActions();
|
||||
|
||||
m_db = new Database();
|
||||
m_group = new Group();
|
||||
m_db->setRootGroup(m_group);
|
||||
m_entry = new Entry();
|
||||
m_entry->setGroup(m_group);
|
||||
m_entry->setUsername("myuser");
|
||||
m_entry->setPassword("mypass");
|
||||
}
|
||||
|
||||
void TestAutoType::cleanup()
|
||||
{
|
||||
delete m_db;
|
||||
}
|
||||
|
||||
void TestAutoType::testInternal()
|
||||
{
|
||||
QVERIFY(m_platform->activeWindowTitle().isEmpty());
|
||||
|
@ -89,4 +96,32 @@ void TestAutoType::testAutoTypeWithSequence()
|
|||
.arg(m_entry->password()));
|
||||
}
|
||||
|
||||
void TestAutoType::testGlobalAutoTypeWithNoMatch()
|
||||
{
|
||||
QList<Database*> dbList;
|
||||
dbList.append(m_db);
|
||||
|
||||
m_autoType->performGlobalAutoType(dbList);
|
||||
|
||||
QCOMPARE(m_test->actionChars(), QString());
|
||||
}
|
||||
|
||||
void TestAutoType::testGlobalAutoTypeWithOneMatch()
|
||||
{
|
||||
QList<Database*> dbList;
|
||||
dbList.append(m_db);
|
||||
AutoTypeAssociations::Association association;
|
||||
association.window = "custom window";
|
||||
association.sequence = "{username}association{password}";
|
||||
m_entry->autoTypeAssociations()->add(association);
|
||||
|
||||
m_test->setActiveWindowTitle("custom window");
|
||||
m_autoType->performGlobalAutoType(dbList);
|
||||
|
||||
QCOMPARE(m_test->actionChars(),
|
||||
QString("%1association%2")
|
||||
.arg(m_entry->username())
|
||||
.arg(m_entry->password()));
|
||||
}
|
||||
|
||||
QTEST_GUILESS_MAIN(TestAutoType)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue