mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-05-02 06:36:07 -04:00
Extend auto-type test.
This commit is contained in:
parent
d7cbec1a02
commit
ac56ac98f7
5 changed files with 60 additions and 4 deletions
|
@ -22,6 +22,8 @@
|
|||
|
||||
#include "tests.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Entry.h"
|
||||
#include "core/Group.h"
|
||||
#include "crypto/Crypto.h"
|
||||
#include "autotype/AutoType.h"
|
||||
#include "autotype/AutoTypePlatformPlugin.h"
|
||||
|
@ -42,6 +44,19 @@ void TestAutoType::initTestCase()
|
|||
|
||||
m_test = qobject_cast<AutoTypeTestInterface*>(loader.instance());
|
||||
QVERIFY(m_test);
|
||||
|
||||
m_autoType = AutoType::instance();
|
||||
}
|
||||
|
||||
void TestAutoType::init()
|
||||
{
|
||||
m_test->clearActions();
|
||||
|
||||
m_group = new Group();
|
||||
m_entry = new Entry();
|
||||
m_entry->setGroup(m_group);
|
||||
m_entry->setUsername("myuser");
|
||||
m_entry->setPassword("mypass");
|
||||
}
|
||||
|
||||
void TestAutoType::testInternal()
|
||||
|
@ -52,4 +67,26 @@ void TestAutoType::testInternal()
|
|||
QCOMPARE(m_platform->activeWindowTitle(), QString("Test"));
|
||||
}
|
||||
|
||||
void TestAutoType::testAutoTypeWithoutSequence()
|
||||
{
|
||||
m_autoType->performAutoType(m_entry, Q_NULLPTR);
|
||||
|
||||
QCOMPARE(m_test->actionCount(), 14);
|
||||
QCOMPARE(m_test->actionChars(),
|
||||
QString("myuser%1mypass%2")
|
||||
.arg(m_test->keyToString(Qt::Key_Tab))
|
||||
.arg(m_test->keyToString(Qt::Key_Enter)));
|
||||
}
|
||||
|
||||
void TestAutoType::testAutoTypeWithSequence()
|
||||
{
|
||||
m_autoType->performAutoType(m_entry, Q_NULLPTR, "{Username}abc{PaSsWoRd}");
|
||||
|
||||
QCOMPARE(m_test->actionCount(), 15);
|
||||
QCOMPARE(m_test->actionChars(),
|
||||
QString("%1abc%2")
|
||||
.arg(m_entry->username())
|
||||
.arg(m_entry->password()));
|
||||
}
|
||||
|
||||
QTEST_GUILESS_MAIN(TestAutoType)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue