aboutsummaryrefslogtreecommitdiffstats
path: root/lang/qt/tests/t-support.cpp
diff options
context:
space:
mode:
authorAndre Heinecke <[email protected]>2019-11-06 08:21:02 +0000
committerAndre Heinecke <[email protected]>2019-11-06 08:21:02 +0000
commite7b5c6405da515101f62acce2837e6c0cc115b76 (patch)
tree5e6c416793ed3ef6a7af7496596b2088faa79b54 /lang/qt/tests/t-support.cpp
parentqt, tests: Replace accidentally commited assert (diff)
downloadgpgme-e7b5c6405da515101f62acce2837e6c0cc115b76.tar.gz
gpgme-e7b5c6405da515101f62acce2837e6c0cc115b76.zip
qt, tests: Add check for supported versions
* lang/qt/tests/t-encrypt.cpp (decryptSupported): Moved to t-support as loopbackSupported. * lang/qt/tests/t-remarks.cpp: Check for loopbackSupported. * lang/qt/tests/t-support.cpp, lang/qt/tests/t-support.h (loopbackSupported): New. -- This ensures that the tests do not fail with GnuPG 2.0.x
Diffstat (limited to 'lang/qt/tests/t-support.cpp')
-rw-r--r--lang/qt/tests/t-support.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/lang/qt/tests/t-support.cpp b/lang/qt/tests/t-support.cpp
index 2444c70f..7b16ccc3 100644
--- a/lang/qt/tests/t-support.cpp
+++ b/lang/qt/tests/t-support.cpp
@@ -44,6 +44,8 @@
#include <QObject>
#include <QDir>
+#include "engineinfo.h"
+
void QGpgMETest::initTestCase()
{
GpgME::initializeLibrary();
@@ -98,5 +100,21 @@ void killAgent(const QString& dir)
proc.waitForFinished();
}
+bool loopbackSupported()
+{
+ /* With GnuPG 2.0.x (at least 2.0.26 by default on jessie)
+ * the passphrase_cb does not work. So the test popped up
+ * a pinentry. So tests requiring decryption don't work. */
+ static auto version = GpgME::engineInfo(GpgME::GpgEngine).engineVersion();
+ if (version < "2.0.0") {
+ /* With 1.4 it just works */
+ return true;
+ }
+ if (version < "2.1.0") {
+ /* With 2.1 it works with loopback mode */
+ return false;
+ }
+ return true;
+}
#include "t-support.hmoc"