Improve testdatabase performance

This commit is contained in:
Jonathan White 2021-06-10 23:17:49 -04:00
parent 25a34a66e1
commit a0912b057e

View File

@ -23,6 +23,7 @@
#include "config-keepassx-tests.h" #include "config-keepassx-tests.h"
#include "core/Metadata.h" #include "core/Metadata.h"
#include "core/Tools.h"
#include "crypto/Crypto.h" #include "crypto/Crypto.h"
#include "format/KeePass2Writer.h" #include "format/KeePass2Writer.h"
#include "keys/PasswordKey.h" #include "keys/PasswordKey.h"
@ -118,6 +119,9 @@ void TestDatabase::testSignals()
QVERIFY(db->save(&error)); QVERIFY(db->save(&error));
QCOMPARE(spySaved.count(), 1); QCOMPARE(spySaved.count(), 1);
// Short delay to allow file system settling to reduce test failures
Tools::wait(100);
QSignalSpy spyFileChanged(db.data(), SIGNAL(databaseFileChanged())); QSignalSpy spyFileChanged(db.data(), SIGNAL(databaseFileChanged()));
QVERIFY(tempFile.copyFromFile(dbFileName)); QVERIFY(tempFile.copyFromFile(dbFileName));
QTRY_COMPARE(spyFileChanged.count(), 1); QTRY_COMPARE(spyFileChanged.count(), 1);