diff options
| author | Andre Heinecke <[email protected]> | 2016-08-25 13:20:02 +0000 | 
|---|---|---|
| committer | Andre Heinecke <[email protected]> | 2016-08-25 13:20:02 +0000 | 
| commit | 053e6e0a7b8ea38ad9d4160c84814867bbb9fcf6 (patch) | |
| tree | 5c291fffeed07e80ac7ae42d396975e159ed2be5 /lang/qt/tests/t-support.cpp | |
| parent | qt: Remove unused variable in test (diff) | |
| download | gpgme-053e6e0a7b8ea38ad9d4160c84814867bbb9fcf6.tar.gz gpgme-053e6e0a7b8ea38ad9d4160c84814867bbb9fcf6.zip  | |
qt: Fix tofuinfo test when gpg is gpg2
* lang/qt/tests/t-support.cpp (QGpgMETest::copyKeyrings): New helper.
* lang/qt/tests/t-support.h: Declare.
* lang/qt/tests/t-encrypt.cpp: use it
* lang/qt/tests/t-tofuinbo.cpp: ditto.
--
New helper takes care of copying the correct files for either
keybox or keyring.
Diffstat (limited to '')
| -rw-r--r-- | lang/qt/tests/t-support.cpp | 26 | 
1 files changed, 26 insertions, 0 deletions
diff --git a/lang/qt/tests/t-support.cpp b/lang/qt/tests/t-support.cpp index ffb0f9ef..73e8d5c2 100644 --- a/lang/qt/tests/t-support.cpp +++ b/lang/qt/tests/t-support.cpp @@ -45,6 +45,31 @@ void QGpgMETest::cleanupTestCase()      killAgent();  } +bool QGpgMETest::copyKeyrings(const QString &src, const QString &dest) +{ +    bool is21dir = QFileInfo(src + QDir::separator() + QStringLiteral("pubring.kbx")).exists(); +    const QString name = is21dir ? QStringLiteral("pubring.kbx") : +                                  QStringLiteral("pubring.gpg"); +    if (!QFile::copy(src + name, dest + QDir::separator() + name)) { +        return false; +    } +    if (!is21dir) { +        return (QFile::copy(src + QDir::separator() + QStringLiteral("secring.gpg"), +                 dest + QDir::separator() + QStringLiteral("secring.gpg"))); +    } +    QDir dir (src + QDir::separator() + QStringLiteral("private-keys-v1.d")); +    QDir target(dest); +    if (!target.mkdir("private-keys-v1.d")) { +        return false; +    } +    foreach (QString f, dir.entryList(QDir::Files)) { +        if (!QFile::copy(src + QDir::separator() + f, dest + QDir::separator() + f)) { +            return false; +        } +    } +    return true; +} +  void killAgent(const QString& dir)  {      QProcess proc; @@ -59,4 +84,5 @@ void killAgent(const QString& dir)      proc.waitForFinished();  } +  #include "t-support.hmoc"  | 
