More auto-type tests.

This commit is contained in:
Florian Geyer 2012-11-02 15:07:44 +01:00
parent 848abfc1a7
commit 8347fd36ba
4 changed files with 46 additions and 1 deletions

View file

@ -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)