diff options
author | Andre Heinecke <[email protected]> | 2016-05-06 14:33:49 +0000 |
---|---|---|
committer | Andre Heinecke <[email protected]> | 2016-05-10 10:51:45 +0000 |
commit | 0e3195948ddaba3af07d2415bb496491076edc17 (patch) | |
tree | 684141b023be7fed053659aaba6bc4c1503832c2 | |
parent | Use common error message style for qt lang checks (diff) | |
download | gpgme-0e3195948ddaba3af07d2415bb496491076edc17.tar.gz gpgme-0e3195948ddaba3af07d2415bb496491076edc17.zip |
Qt: Add test for async keylisting
* src/lang/qt/tests/t-keylist.cpp(KeyListTest::testKeyListAsync): New.
-rw-r--r-- | lang/qt/tests/t-keylist.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lang/qt/tests/t-keylist.cpp b/lang/qt/tests/t-keylist.cpp index 8aa59990..f5c7f131 100644 --- a/lang/qt/tests/t-keylist.cpp +++ b/lang/qt/tests/t-keylist.cpp @@ -1,15 +1,20 @@ #include <QDebug> #include <QTest> +#include <QSignalSpy> #include "keylistjob.h" #include "qgpgmebackend.h" #include "keylistresult.h" using namespace QGpgME; +using namespace GpgME; class KeyListTest : public QObject { Q_OBJECT +Q_SIGNALS: + void asyncDone(); + private Q_SLOTS: void testSingleKeyListSync() @@ -24,6 +29,19 @@ private Q_SLOTS: Q_ASSERT (kId == QStringLiteral("2D727CC768697734")); } + void testKeyListAsync() + { + KeyListJob *job = openpgp()->keyListJob(); + connect(job, &KeyListJob::result, job, [this, job](KeyListResult, std::vector<Key> keys, QString, Error) + { + Q_ASSERT(keys.size() == 1); + Q_EMIT asyncDone(); + }); + job->start(QStringList() << "[email protected]"); + QSignalSpy spy (this, &KeyListTest::asyncDone); + Q_ASSERT(spy.wait()); + } + void initTestCase() { const QString gpgHome = qgetenv("GNUPGHOME"); |