From d308910cdfb31accae7cf790a956eb2f3cc6ae71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= Date: Thu, 13 Jan 2022 12:40:35 +0100 Subject: 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 --- lang/qt/tests/t-support.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'lang/qt/tests/t-support.cpp') 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 @@ -44,8 +45,12 @@ #include #include +#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; -- cgit v1.2.3