summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSune Vuorela <sune@vuorela.dk>2023-06-05 12:36:44 +0200
committerAlbert Astals Cid <tsdgeos@yahoo.es>2023-06-05 16:33:23 +0000
commitdef45c82b36ec393fbaf16d9873db23bc9659b80 (patch)
tree8833ca03f1e80e7e9c614e587e27e68b1b30cc0d
parentf0373f62df9cb6b7bff29150344fddfe1e8361c5 (diff)
Don't fail signature basics tests if backend is not configured
-rw-r--r--qt5/tests/check_signature_basics.cpp22
-rw-r--r--qt6/tests/check_signature_basics.cpp22
2 files changed, 34 insertions, 10 deletions
diff --git a/qt5/tests/check_signature_basics.cpp b/qt5/tests/check_signature_basics.cpp
index 94aad2f6..635e04c9 100644
--- a/qt5/tests/check_signature_basics.cpp
+++ b/qt5/tests/check_signature_basics.cpp
@@ -58,11 +58,23 @@ void TestSignatureBasics::initTestCase_data()
{
QTest::addColumn<CryptoSign::Backend::Type>("backend");
-#ifdef ENABLE_NSS3
- QTest::newRow("nss") << CryptoSign::Backend::Type::NSS3;
-#endif
-#ifdef ENABLE_GPGME
- QTest::newRow("gpg") << CryptoSign::Backend::Type::GPGME;
+#ifdef ENABLE_SIGNATURES
+ const auto availableBackends = CryptoSign::Factory::getAvailable();
+
+# ifdef ENABLE_NSS3
+ if (std::find(availableBackends.begin(), availableBackends.end(), CryptoSign::Backend::Type::NSS3) != availableBackends.end()) {
+ QTest::newRow("nss") << CryptoSign::Backend::Type::NSS3;
+ } else {
+ QWARN("Compiled with NSS3, but NSS not functional");
+ }
+# endif
+# ifdef ENABLE_GPGME
+ if (std::find(availableBackends.begin(), availableBackends.end(), CryptoSign::Backend::Type::GPGME) != availableBackends.end()) {
+ QTest::newRow("gpg") << CryptoSign::Backend::Type::GPGME;
+ } else {
+ QWARN("Compiled with GPGME, but GPGME not functional");
+ }
+# endif
#endif
}
diff --git a/qt6/tests/check_signature_basics.cpp b/qt6/tests/check_signature_basics.cpp
index 25589e93..9a9955c2 100644
--- a/qt6/tests/check_signature_basics.cpp
+++ b/qt6/tests/check_signature_basics.cpp
@@ -56,11 +56,23 @@ void TestSignatureBasics::initTestCase_data()
{
QTest::addColumn<CryptoSign::Backend::Type>("backend");
-#ifdef ENABLE_NSS3
- QTest::newRow("nss") << CryptoSign::Backend::Type::NSS3;
-#endif
-#ifdef ENABLE_GPGME
- QTest::newRow("gpg") << CryptoSign::Backend::Type::GPGME;
+#ifdef ENABLE_SIGNATURES
+ const auto availableBackends = CryptoSign::Factory::getAvailable();
+
+# ifdef ENABLE_NSS3
+ if (std::find(availableBackends.begin(), availableBackends.end(), CryptoSign::Backend::Type::NSS3) != availableBackends.end()) {
+ QTest::newRow("nss") << CryptoSign::Backend::Type::NSS3;
+ } else {
+ QWARN("Compiled with NSS3, but NSS not functional");
+ }
+# endif
+# ifdef ENABLE_GPGME
+ if (std::find(availableBackends.begin(), availableBackends.end(), CryptoSign::Backend::Type::GPGME) != availableBackends.end()) {
+ QTest::newRow("gpg") << CryptoSign::Backend::Type::GPGME;
+ } else {
+ QWARN("Compiled with GPGME, but GPGME not functional");
+ }
+# endif
#endif
}