diff options
author | Jonathan White <support@dmapps.us> | 2019-12-31 20:40:00 +0300 |
---|---|---|
committer | Jonathan White <support@dmapps.us> | 2020-01-04 02:08:24 +0300 |
commit | 7ad330eccba89bff67325f98f0e66e2647c45cf6 (patch) | |
tree | 3e5f1a9104ecacbee0be0f48c230707631eb10fc /tests | |
parent | 7250fd931314caffb7d2f28ac0eff943d85d3c94 (diff) |
Improve GUI test reliability
* Explicitly resize the window to improve testing on High DPI displays
* Add additional bootstrap calls to mimic the actual application
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gui/TestGui.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tests/gui/TestGui.cpp b/tests/gui/TestGui.cpp index 2a0bef483..48b5c7351 100644 --- a/tests/gui/TestGui.cpp +++ b/tests/gui/TestGui.cpp @@ -79,6 +79,10 @@ static QString dbFileName = QStringLiteral(KEEPASSX_TEST_DATA_DIR).append("/NewD void TestGui::initTestCase() { + Application::setApplicationName("KeePassXC"); + Application::setApplicationVersion(KEEPASSXC_VERSION); + QApplication::setQuitOnLastWindowClosed(false); + QVERIFY(Crypto::init()); Config::createTempFileInstance(); // Disable autosave so we can test the modified file indicator @@ -91,11 +95,12 @@ void TestGui::initTestCase() // Disable the update check first time alert config()->set("UpdateCheckMessageShown", true); - m_mainWindow.reset(new MainWindow()); - Bootstrap::restoreMainWindowState(*m_mainWindow); Bootstrap::bootstrapApplication(); + + m_mainWindow.reset(new MainWindow()); m_tabWidget = m_mainWindow->findChild<DatabaseTabWidget*>("tabWidget"); m_mainWindow->show(); + m_mainWindow->resize(1024, 768); } // Every test starts with opening the temp database @@ -176,7 +181,7 @@ void TestGui::testSettingsDefaultTabOrder() void TestGui::testCreateDatabase() { - QTimer::singleShot(0, this, SLOT(createDatabaseCallback())); + QTimer::singleShot(50, this, SLOT(createDatabaseCallback())); triggerAction("actionDatabaseNew"); // there is a new empty db @@ -1435,8 +1440,9 @@ int TestGui::addCannedEntries() void TestGui::checkDatabase(QString dbFileName) { - if (dbFileName.isEmpty()) + if (dbFileName.isEmpty()) { dbFileName = m_dbFilePath; + } auto key = QSharedPointer<CompositeKey>::create(); key->addKey(QSharedPointer<PasswordKey>::create("a")); |