[Pkg-gnupg-commit] [gpgme] 71/412: Qt: Add test for async keylisting

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Sep 22 21:26:18 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gpgme.

commit 0e3195948ddaba3af07d2415bb496491076edc17
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Fri May 6 16:33:49 2016 +0200

    Qt: Add test for async keylisting
    
    * src/lang/qt/tests/t-keylist.cpp(KeyListTest::testKeyListAsync): New.
---
 lang/qt/tests/t-keylist.cpp | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/lang/qt/tests/t-keylist.cpp b/lang/qt/tests/t-keylist.cpp
index 8aa5999..f5c7f13 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() << "alfa at example.net");
+        QSignalSpy spy (this, &KeyListTest::asyncDone);
+        Q_ASSERT(spy.wait());
+    }
+
     void initTestCase()
     {
         const QString gpgHome = qgetenv("GNUPGHOME");

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gpgme.git



More information about the Pkg-gnupg-commit mailing list