From faf987dd62893955251378a2a715edd2892a540c Mon Sep 17 00:00:00 2001 From: Andre Heinecke Date: Sun, 3 Apr 2016 01:48:46 -0800 Subject: Qt: Add a unit test for qgpgme * configure.ac: Configure test Makefile. * m4/qt.m4: Look up Qt5Test flags. * lang/qt/tests/t-keylist.cpp: New. Simple keylist check. * lang/qt/tests/Makefile.am: New. General test framework. -- This test mostly checks that it basically compiles / works and adds a test framework. --- lang/qt/tests/t-keylist.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 lang/qt/tests/t-keylist.cpp (limited to 'lang/qt/tests/t-keylist.cpp') diff --git a/lang/qt/tests/t-keylist.cpp b/lang/qt/tests/t-keylist.cpp new file mode 100644 index 00000000..67ace7f5 --- /dev/null +++ b/lang/qt/tests/t-keylist.cpp @@ -0,0 +1,31 @@ +#include +#include +#include "keylistjob.h" +#include "qgpgmebackend.h" +#include "keylistresult.h" + +using namespace QGpgME; + +class KeyListTest : public QObject +{ + Q_OBJECT + +private Q_SLOTS: + + void testSingleKeyListSync() + { + QGpgMEBackend backend; + KeyListJob *job = backend.openpgp()->keyListJob(false, false, false); + std::vector keys; + GpgME::KeyListResult result = job->exec(QStringList() << QStringLiteral("alfa@example.net"), + false, keys); + Q_ASSERT (!result.error()); + Q_ASSERT (keys.size() == 1); + const QString kId = QLatin1String(keys.front().keyID()); + Q_ASSERT (kId == QStringLiteral("2D727CC768697734")); + } +}; + +QTEST_MAIN(KeyListTest) + +#include "t-keylist.moc" -- cgit v1.2.3