aboutsummaryrefslogtreecommitdiffstats
path: root/lang/qt/tests/t-tofuinfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lang/qt/tests/t-tofuinfo.cpp')
-rw-r--r--lang/qt/tests/t-tofuinfo.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/lang/qt/tests/t-tofuinfo.cpp b/lang/qt/tests/t-tofuinfo.cpp
index e16b1fde..8d040bc3 100644
--- a/lang/qt/tests/t-tofuinfo.cpp
+++ b/lang/qt/tests/t-tofuinfo.cpp
@@ -118,7 +118,24 @@ Q_SIGNALS:
private:
bool testSupported()
{
- return !(GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.1.16");
+ static bool initialized, supported;
+ if (initialized) {
+ return supported;
+ }
+ initialized = true;
+ if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.1.16") {
+ return false;
+ }
+ // If the keylist fails here this means that gnupg does not
+ // support tofu at all. It can be disabled at compile time. So no
+ // tests.
+ auto *job = openpgp()->keyListJob(false, false, false);
+ job->addMode(GpgME::WithTofu);
+ std::vector<GpgME::Key> keys;
+ job->exec(QStringList() << QStringLiteral("[email protected]"), true, keys);
+ delete job;
+ supported = !keys.empty();
+ return supported;
}
void testTofuCopy(TofuInfo other, const TofuInfo &orig)
@@ -402,6 +419,10 @@ private Q_SLOTS:
void testTofuConflict()
{
+ if (!testSupported()) {
+ return;
+ }
+
if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.1.19") {
return;
}