[pim/libkleo] autotests: formattingtest: Support GnuPG >= 2.5.22 and GpgME >= 2.1.3
Ingo Klöcker <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit e8b5335d56a7cec0024bd0598601ef0b2b3b90df by Ingo Klöcker, on behalf of Ingo Klöcker.
Committed on 30/07/2026 at 14:06.
Pushed by kloecker into branch 'master'.
formattingtest: Support GnuPG >= 2.5.22 and GpgME >= 2.1.3
GnuPG 2.5.22 (and later) emits the creation time also for bad signatures
and GpgME >= 2.1.3 parses this information.
Note: The test will fail if libkleo is compiled against GpgME < 2.1.3
but run with GpgME >= 2.1.3 (and new enough GnuPG).
GnuPG-bug-id: 7786
M +16 -4 autotests/formattingtest.cpp
https://invent.kde.org/pim/libkleo/-/commit/e8b5335d56a7cec0024bd0598601ef0b2b3b90df
diff --git a/autotests/formattingtest.cpp b/autotests/formattingtest.cpp
index 1280da7c..2c8d5e4f 100644
--- a/autotests/formattingtest.cpp
+++ b/autotests/formattingtest.cpp
@@ -28,6 +28,8 @@
#include <gpgme++/signingresult.h>
#include <gpgme++/verificationresult.h>
+#include <gpgme.h>
+
using namespace Kleo;
using namespace GpgME;
using namespace Qt::Literals::StringLiterals;
@@ -458,10 +460,20 @@ private Q_SLOTS:
<< u"The signature cannot be verified because the corresponding certificate is not available. The data cannot be trusted. The signing "
"certificate’s fingerprint is <a href=\"certificate:C8C6053CA0018BCB1C0D3C1AF9F33E35E1C16A17\">"
"C8C6 053C A001 8BCB 1C0D 3C1A F9F3 3E35 E1C1 6A17</a>."_s;
- QTest::newRow("signature-bad")
- << Signature::Summary::Red << GPG_ERR_BAD_SIGNATURE << Signature::Validity::Unknown
- << u"The data cannot be trusted. Reason: Data and signature do not match.<br/>"
- "The signature claims to be from <a href=\"key:117C22E18017CB18A67FC3D699954415471E4A5F\">Second UID <[email protected]> (DATE)</a>."_s;
+#if GPGME_VERSION_NUMBER >= 0x020103
+ if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() >= "2.5.22") {
+ QTest::newRow("signature-bad")
+ << Signature::Summary::Red << GPG_ERR_BAD_SIGNATURE << Signature::Validity::Unknown
+ << u"The data cannot be trusted. Reason: Data and signature do not match.<br/>"
+ "The signature claims to be from <a href=\"key:117C22E18017CB18A67FC3D699954415471E4A5F\">Second UID <[email protected]> (DATE)</a> and dated DATETIME."_s;
+ } else
+#endif
+ {
+ QTest::newRow("signature-bad")
+ << Signature::Summary::Red << GPG_ERR_BAD_SIGNATURE << Signature::Validity::Unknown
+ << u"The data cannot be trusted. Reason: Data and signature do not match.<br/>"
+ "The signature claims to be from <a href=\"key:117C22E18017CB18A67FC3D699954415471E4A5F\">Second UID <[email protected]> (DATE)</a>."_s;
+ }
QTest::newRow("signature-expired")
<< Signature::Summary::SigExpired << GPG_ERR_SIG_EXPIRED << Signature::Validity::Unknown
<< u"The data cannot be trusted. Reason: The signature has expired.<br/>"