[Pkg-gnupg-commit] [gpgme] 205/412: Qt: Add test for publicKeyAlgorithmAsString

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Sep 22 21:26:48 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 fc0267233239b42e9fb74a8acd7511503e287a9e
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Jul 6 15:09:16 2016 +0200

    Qt: Add test for publicKeyAlgorithmAsString
    
    * lang/qt/tests/t-keylist.cpp (testPubkeyAlgoAsString): New.
---
 lang/qt/tests/t-keylist.cpp | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/lang/qt/tests/t-keylist.cpp b/lang/qt/tests/t-keylist.cpp
index 591a552..38d315f 100644
--- a/lang/qt/tests/t-keylist.cpp
+++ b/lang/qt/tests/t-keylist.cpp
@@ -32,6 +32,7 @@
 #include <QDebug>
 #include <QTest>
 #include <QSignalSpy>
+#include <QMap>
 #include "keylistjob.h"
 #include "qgpgmebackend.h"
 #include "keylistresult.h"
@@ -64,6 +65,27 @@ private Q_SLOTS:
         Q_ASSERT (keys[0].subkeys()[1].publicKeyAlgorithm() == Subkey::AlgoELG_E);
     }
 
+    void testPubkeyAlgoAsString()
+    {
+        static const QMap<Subkey::PubkeyAlgo, QString> expected {
+            { Subkey::AlgoRSA,    QStringLiteral("RSA") },
+            { Subkey::AlgoRSA_E,  QStringLiteral("RSA-E") },
+            { Subkey::AlgoRSA_S,  QStringLiteral("RSA-S") },
+            { Subkey::AlgoELG_E,  QStringLiteral("ELG-E") },
+            { Subkey::AlgoDSA,    QStringLiteral("DSA") },
+            { Subkey::AlgoECC,    QStringLiteral("ECC") },
+            { Subkey::AlgoELG,    QStringLiteral("ELG") },
+            { Subkey::AlgoECDSA,  QStringLiteral("ECDSA") },
+            { Subkey::AlgoECDH,   QStringLiteral("ECDH") },
+            { Subkey::AlgoEDDSA,  QStringLiteral("EdDSA") },
+            { Subkey::AlgoUnknown, QString() }
+        };
+        Q_FOREACH (Subkey::PubkeyAlgo algo, expected.keys()) {
+            Q_ASSERT(QString::fromUtf8(Subkey::publicKeyAlgorithmAsString(algo)) ==
+                     expected.value(algo));
+        }
+    }
+
     void testKeyListAsync()
     {
         KeyListJob *job = openpgp()->keyListJob();

-- 
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