mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-25 07:19:42 -05:00
Improve GUI test reliability
* Explicitly resize the window to improve testing on High DPI displays * Add additional bootstrap calls to mimic the actual application
This commit is contained in:
parent
7250fd9313
commit
7ad330eccb
@ -79,6 +79,10 @@ static QString dbFileName = QStringLiteral(KEEPASSX_TEST_DATA_DIR).append("/NewD
|
|||||||
|
|
||||||
void TestGui::initTestCase()
|
void TestGui::initTestCase()
|
||||||
{
|
{
|
||||||
|
Application::setApplicationName("KeePassXC");
|
||||||
|
Application::setApplicationVersion(KEEPASSXC_VERSION);
|
||||||
|
QApplication::setQuitOnLastWindowClosed(false);
|
||||||
|
|
||||||
QVERIFY(Crypto::init());
|
QVERIFY(Crypto::init());
|
||||||
Config::createTempFileInstance();
|
Config::createTempFileInstance();
|
||||||
// Disable autosave so we can test the modified file indicator
|
// Disable autosave so we can test the modified file indicator
|
||||||
@ -91,11 +95,12 @@ void TestGui::initTestCase()
|
|||||||
// Disable the update check first time alert
|
// Disable the update check first time alert
|
||||||
config()->set("UpdateCheckMessageShown", true);
|
config()->set("UpdateCheckMessageShown", true);
|
||||||
|
|
||||||
m_mainWindow.reset(new MainWindow());
|
|
||||||
Bootstrap::restoreMainWindowState(*m_mainWindow);
|
|
||||||
Bootstrap::bootstrapApplication();
|
Bootstrap::bootstrapApplication();
|
||||||
|
|
||||||
|
m_mainWindow.reset(new MainWindow());
|
||||||
m_tabWidget = m_mainWindow->findChild<DatabaseTabWidget*>("tabWidget");
|
m_tabWidget = m_mainWindow->findChild<DatabaseTabWidget*>("tabWidget");
|
||||||
m_mainWindow->show();
|
m_mainWindow->show();
|
||||||
|
m_mainWindow->resize(1024, 768);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Every test starts with opening the temp database
|
// Every test starts with opening the temp database
|
||||||
@ -176,7 +181,7 @@ void TestGui::testSettingsDefaultTabOrder()
|
|||||||
|
|
||||||
void TestGui::testCreateDatabase()
|
void TestGui::testCreateDatabase()
|
||||||
{
|
{
|
||||||
QTimer::singleShot(0, this, SLOT(createDatabaseCallback()));
|
QTimer::singleShot(50, this, SLOT(createDatabaseCallback()));
|
||||||
triggerAction("actionDatabaseNew");
|
triggerAction("actionDatabaseNew");
|
||||||
|
|
||||||
// there is a new empty db
|
// there is a new empty db
|
||||||
@ -1435,8 +1440,9 @@ int TestGui::addCannedEntries()
|
|||||||
|
|
||||||
void TestGui::checkDatabase(QString dbFileName)
|
void TestGui::checkDatabase(QString dbFileName)
|
||||||
{
|
{
|
||||||
if (dbFileName.isEmpty())
|
if (dbFileName.isEmpty()) {
|
||||||
dbFileName = m_dbFilePath;
|
dbFileName = m_dbFilePath;
|
||||||
|
}
|
||||||
|
|
||||||
auto key = QSharedPointer<CompositeKey>::create();
|
auto key = QSharedPointer<CompositeKey>::create();
|
||||||
key->addKey(QSharedPointer<PasswordKey>::create("a"));
|
key->addKey(QSharedPointer<PasswordKey>::create("a"));
|
||||||
|
Loading…
Reference in New Issue
Block a user