aboutsummaryrefslogtreecommitdiffstats
path: root/lang/qt/tests/t-support.cpp
diff options
context:
space:
mode:
authorIngo Klöcker <[email protected]>2022-01-13 11:40:35 +0000
committerIngo Klöcker <[email protected]>2022-01-13 11:40:35 +0000
commitd308910cdfb31accae7cf790a956eb2f3cc6ae71 (patch)
treedf337883072d4ea5c7e01ab04cab84449665be54 /lang/qt/tests/t-support.cpp
parentqt,tests: Add asyncDone signal to base class of all tests (diff)
downloadgpgme-d308910cdfb31accae7cf790a956eb2f3cc6ae71.tar.gz
gpgme-d308910cdfb31accae7cf790a956eb2f3cc6ae71.zip
qt,tests: Add helper to hook up the test passphrase provider
* lang/qt/tests/t-support.h, lang/qt/tests/t-support.cpp (class QGpgMETest): Add member function hookUpPassphraseProvider. Add member mPassphraseProvider. * lang/qt/tests/t-changeexpiryjob.cpp, lang/qt/tests/t-encrypt.cpp, lang/qt/tests/t-remarks.cpp, lang/qt/tests/t-tofuinfo.cpp, lang/qt/tests/t-trustsignatures.cpp, lang/qt/tests/t-various.cpp: Use new helper. -- GnuPG-bug-id: 5770
Diffstat (limited to 'lang/qt/tests/t-support.cpp')
-rw-r--r--lang/qt/tests/t-support.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/lang/qt/tests/t-support.cpp b/lang/qt/tests/t-support.cpp
index 854dd7bd..e827b517 100644
--- a/lang/qt/tests/t-support.cpp
+++ b/lang/qt/tests/t-support.cpp
@@ -35,7 +35,8 @@
#endif
#include "t-support.h"
-#include "context.h"
+
+#include "job.h"
#include <QTest>
@@ -44,8 +45,12 @@
#include <QObject>
#include <QDir>
+#include "context.h"
#include "engineinfo.h"
+using namespace GpgME;
+using namespace QGpgME;
+
void QGpgMETest::initTestCase()
{
GpgME::initializeLibrary();
@@ -92,6 +97,17 @@ bool QGpgMETest::copyKeyrings(const QString &src, const QString &dest)
return true;
}
+void QGpgMETest::hookUpPassphraseProvider(GpgME::Context *context)
+{
+ context->setPassphraseProvider(&mPassphraseProvider);
+ context->setPinentryMode(Context::PinentryLoopback);
+}
+
+void QGpgMETest::hookUpPassphraseProvider(QGpgME::Job *job)
+{
+ hookUpPassphraseProvider(Job::context(job));
+}
+
void killAgent(const QString& dir)
{
QProcess proc;