diff options
| author | Andre Heinecke <[email protected]> | 2016-07-11 14:47:30 +0000 | 
|---|---|---|
| committer | Andre Heinecke <[email protected]> | 2016-07-11 14:51:58 +0000 | 
| commit | bfa8ac7e02c16790ee5bd3b42c26699f4821d72e (patch) | |
| tree | 6fcc12316dce78da545cf960d7d1ed97fcae231f | |
| parent | Qt: Add some general Protocol documentation (diff) | |
| download | gpgme-bfa8ac7e02c16790ee5bd3b42c26699f4821d72e.tar.gz gpgme-bfa8ac7e02c16790ee5bd3b42c26699f4821d72e.zip | |
Qt: Fix memleaks in tests
* lang/qt/tests/t-keylist.cpp(cleanupTestCase): Ensure that
posted events are handled for autodeletion.
(testSingleKeylistSync): delete job.
* lang/qt/tests/t-ownertrust.cpp(cleanupTestCase): Ditto
* lang/qt/tests/t-ownertrust.cpp(testChangeOwnerTrust): Delete
keylistjobs.
* lang/qt/tests/t-keylocate.cpp(cleanupTestCase): Ditto
| -rw-r--r-- | lang/qt/tests/t-keylist.cpp | 6 | ||||
| -rw-r--r-- | lang/qt/tests/t-keylocate.cpp | 5 | ||||
| -rw-r--r-- | lang/qt/tests/t-ownertrust.cpp | 9 | 
3 files changed, 20 insertions, 0 deletions
| diff --git a/lang/qt/tests/t-keylist.cpp b/lang/qt/tests/t-keylist.cpp index 38d315f5..adc997aa 100644 --- a/lang/qt/tests/t-keylist.cpp +++ b/lang/qt/tests/t-keylist.cpp @@ -55,6 +55,7 @@ private Q_SLOTS:          std::vector<GpgME::Key> keys;          GpgME::KeyListResult result = job->exec(QStringList() << QStringLiteral("[email protected]"),                                                  false, keys); +        delete job;          Q_ASSERT (!result.error());          Q_ASSERT (keys.size() == 1);          const QString kId = QLatin1String(keys.front().keyID()); @@ -104,6 +105,11 @@ private Q_SLOTS:          const QString gpgHome = qgetenv("GNUPGHOME");          QVERIFY2(!gpgHome.isEmpty(), "GNUPGHOME environment variable is not set.");      } + +    void cleanupTestCase() +    { +        QCoreApplication::sendPostedEvents(); +    }  };  QTEST_MAIN(KeyListTest) diff --git a/lang/qt/tests/t-keylocate.cpp b/lang/qt/tests/t-keylocate.cpp index 682f722c..43aaf1c4 100644 --- a/lang/qt/tests/t-keylocate.cpp +++ b/lang/qt/tests/t-keylocate.cpp @@ -120,6 +120,11 @@ private Q_SLOTS:          const QString gpgHome = qgetenv("GNUPGHOME");          QVERIFY2(!gpgHome.isEmpty(), "GNUPGHOME environment variable is not set.");      } + +    void cleanupTestCase() +    { +        QCoreApplication::sendPostedEvents(); +    }  private:      QString mTestpattern;  }; diff --git a/lang/qt/tests/t-ownertrust.cpp b/lang/qt/tests/t-ownertrust.cpp index 9a0c1cd0..8784a796 100644 --- a/lang/qt/tests/t-ownertrust.cpp +++ b/lang/qt/tests/t-ownertrust.cpp @@ -55,6 +55,7 @@ private Q_SLOTS:          std::vector<GpgME::Key> keys;          GpgME::KeyListResult result = job->exec(QStringList() << QStringLiteral("[email protected]"),                                                  false, keys); +        delete job;          Q_ASSERT (!result.error());          Q_ASSERT (keys.size() == 1);          Key key = keys.front(); @@ -76,6 +77,7 @@ private Q_SLOTS:          job = openpgp()->keyListJob(false, true, true);          result = job->exec(QStringList() << QStringLiteral("[email protected]"),                             false, keys); +        delete job;          key = keys.front();          Q_ASSERT (key.ownerTrust() == Key::Ultimate); @@ -91,6 +93,8 @@ private Q_SLOTS:          job = openpgp()->keyListJob(false, true, true);          result = job->exec(QStringList() << QStringLiteral("[email protected]"),                             false, keys); +        delete job; +          key = keys.front();          Q_ASSERT (key.ownerTrust() == Key::Unknown);      } @@ -100,6 +104,11 @@ private Q_SLOTS:          const QString gpgHome = qgetenv("GNUPGHOME");          QVERIFY2(!gpgHome.isEmpty(), "GNUPGHOME environment variable is not set.");      } + +    void cleanupTestCase() +    { +        QCoreApplication::sendPostedEvents(); +    }  };  QTEST_MAIN(ChangeOwnerTrustTest) | 
