Imported Upstream version 1.14.0
[platform/upstream/gpgme.git] / lang / qt / tests / t-support.h
index 704fab4..77bef56 100644 (file)
@@ -1,7 +1,8 @@
 /* t-support.h
 
     This file is part of qgpgme, the Qt API binding for gpgme
-    Copyright (c) 2016 Intevation GmbH
+    Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
+    Software engineering by Intevation GmbH
 
     QGpgME is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License as
@@ -34,6 +35,8 @@
 #include "interfaces/passphraseprovider.h"
 #include <QObject>
 
+#include <gpg-error.h>
+
 namespace GpgME
 {
 class TestPassphraseProvider : public PassphraseProvider
@@ -42,12 +45,16 @@ public:
     char *getPassphrase(const char * /*useridHint*/, const char * /*description*/,
                         bool /*previousWasBad*/, bool &/*canceled*/) Q_DECL_OVERRIDE
     {
-        return strdup("abc");
+        char *ret;
+        gpgrt_asprintf(&ret, "abc");
+        return ret;
     }
 };
 } // namespace GpgME
 
 void killAgent(const QString &dir = qgetenv("GNUPGHOME"));
+/* Is the passphrase Provider / loopback Supported */
+bool loopbackSupported();
 
 class QGpgMETest : public QObject
 {
@@ -60,4 +67,8 @@ public Q_SLOTS:
     void cleanupTestCase();
 };
 
+/* Timeout, in milliseconds, for use with QSignalSpy to wait on
+   signals.  */
+#define QSIGNALSPY_TIMEOUT     60000
+
 #endif // T_SUPPORT_H