diff options
author | Jonathan White <support@dmapps.us> | 2021-06-12 05:13:52 +0300 |
---|---|---|
committer | Jonathan White <support@dmapps.us> | 2021-06-12 05:13:52 +0300 |
commit | 9c108b95100bfa3b172edcfd5754aa2e831a3221 (patch) | |
tree | 837101ac7854d5df6adaf49fdfa76cd84494c896 /tests | |
parent | 2b262c5b2438d8ef8febcde5ede2043a4e00c192 (diff) | |
parent | 596821ca0d1be143a16501bc978feeb801db6f79 (diff) |
Fixed
- Fix focusing search when pressing hotkey [#6603]
- Trim whitespace from TOTP key input prior to processing [#6604]
- Fix building on macOS [#6598]
- Resolve compiler warnings for unused return values [#6607]
Diffstat (limited to 'tests')
-rw-r--r-- | tests/TestDatabase.cpp | 4 | ||||
-rw-r--r-- | tests/TestKeys.cpp | 2 | ||||
-rw-r--r-- | tests/gui/TestGui.cpp | 13 | ||||
-rw-r--r-- | tests/gui/TestGui.h | 2 |
4 files changed, 9 insertions, 12 deletions
diff --git a/tests/TestDatabase.cpp b/tests/TestDatabase.cpp index c3a3a8c42..8ec4a1bd7 100644 --- a/tests/TestDatabase.cpp +++ b/tests/TestDatabase.cpp @@ -23,6 +23,7 @@ #include "config-keepassx-tests.h" #include "core/Metadata.h" +#include "core/Tools.h" #include "crypto/Crypto.h" #include "format/KeePass2Writer.h" #include "keys/PasswordKey.h" @@ -118,6 +119,9 @@ void TestDatabase::testSignals() QVERIFY(db->save(&error)); QCOMPARE(spySaved.count(), 1); + // Short delay to allow file system settling to reduce test failures + Tools::wait(100); + QSignalSpy spyFileChanged(db.data(), SIGNAL(databaseFileChanged())); QVERIFY(tempFile.copyFromFile(dbFileName)); QTRY_COMPARE(spyFileChanged.count(), 1); diff --git a/tests/TestKeys.cpp b/tests/TestKeys.cpp index cbbaae398..9fa75f795 100644 --- a/tests/TestKeys.cpp +++ b/tests/TestKeys.cpp @@ -235,7 +235,7 @@ void TestKeys::benchmarkTransformKey() QBENCHMARK { - Q_UNUSED(compositeKey->transform(kdf, result)); + Q_UNUSED(!compositeKey->transform(kdf, result)); }; } diff --git a/tests/gui/TestGui.cpp b/tests/gui/TestGui.cpp index 65ca319bc..0de8be359 100644 --- a/tests/gui/TestGui.cpp +++ b/tests/gui/TestGui.cpp @@ -853,7 +853,7 @@ void TestGui::testTotp() void TestGui::testSearch() { // Add canned entries for consistent testing - Q_UNUSED(addCannedEntries()); + addCannedEntries(); auto* toolBar = m_mainWindow->findChild<QToolBar*>("toolBar"); @@ -1007,7 +1007,7 @@ void TestGui::testSearch() void TestGui::testDeleteEntry() { // Add canned entries for consistent testing - Q_UNUSED(addCannedEntries()); + addCannedEntries(); auto* groupView = m_dbWidget->findChild<GroupView*>("groupView"); auto* entryView = m_dbWidget->findChild<EntryView*>("entryView"); @@ -1673,10 +1673,8 @@ void TestGui::testAutoType() entryView->selectionModel()->clearSelection(); } -int TestGui::addCannedEntries() +void TestGui::addCannedEntries() { - int entries_added = 0; - // Find buttons auto* toolBar = m_mainWindow->findChild<QToolBar*>("toolBar"); QWidget* entryNewWidget = toolBar->widgetForAction(m_mainWindow->findChild<QAction*>("actionEntryNew")); @@ -1689,22 +1687,17 @@ int TestGui::addCannedEntries() QTest::keyClicks(titleEdit, "test"); auto* editEntryWidgetButtonBox = editEntryWidget->findChild<QDialogButtonBox*>("buttonBox"); QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Ok), Qt::LeftButton); - ++entries_added; // Add entry "something 2" QTest::mouseClick(entryNewWidget, Qt::LeftButton); QTest::keyClicks(titleEdit, "something 2"); QTest::keyClicks(passwordEdit, "something 2"); QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Ok), Qt::LeftButton); - ++entries_added; // Add entry "something 3" QTest::mouseClick(entryNewWidget, Qt::LeftButton); QTest::keyClicks(titleEdit, "something 3"); QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Ok), Qt::LeftButton); - ++entries_added; - - return entries_added; } void TestGui::checkDatabase(QString dbFileName) diff --git a/tests/gui/TestGui.h b/tests/gui/TestGui.h index 5bfc04265..b41e22227 100644 --- a/tests/gui/TestGui.h +++ b/tests/gui/TestGui.h @@ -72,7 +72,7 @@ private slots: void testTrayRestoreHide(); private: - int addCannedEntries(); + void addCannedEntries(); void checkDatabase(QString dbFileName = ""); void triggerAction(const QString& name); void dragAndDropGroup(const QModelIndex& sourceIndex, |