From 773b37fb382059ff1deccc47251a907143b95f27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Thu, 24 Jun 2021 18:28:06 +0200 Subject: [PATCH] tst_QSslSocket: Use supportedFeatures() instead of macro It needs to be checked at runtime to know if the current backend supports it Pick-to: 6.2 Change-Id: I0998309149b109e2075a008b2b8d8115fa3688cc Reviewed-by: Timur Pocheptsov --- tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index 475217b046..4669d10fa3 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -218,9 +218,7 @@ private slots: void waitForMinusOne(); void verifyMode(); void verifyDepth(); -#if QT_CONFIG(openssl) void verifyAndDefaultConfiguration(); -#endif void disconnectFromHostWhenConnecting(); void disconnectFromHostWhenConnected(); #if QT_CONFIG(openssl) @@ -2672,12 +2670,13 @@ void tst_QSslSocket::verifyDepth() QCOMPARE(socket.peerVerifyDepth(), 1); } -#if QT_CONFIG(openssl) void tst_QSslSocket::verifyAndDefaultConfiguration() { QFETCH_GLOBAL(const bool, setProxy); if (setProxy) return; + if (!QSslSocket::supportedFeatures().contains(QSsl::SupportedFeature::CertificateVerification)) + QSKIP("This backend doesn't support manual certificate verification"); const auto defaultCACertificates = QSslConfiguration::defaultConfiguration().caCertificates(); const auto chainGuard = qScopeGuard([&defaultCACertificates]{ auto conf = QSslConfiguration::defaultConfiguration(); @@ -2707,7 +2706,6 @@ void tst_QSslSocket::verifyAndDefaultConfiguration() QCOMPARE(QSslConfiguration::defaultConfiguration().caCertificates(), QList{caCert}); #endif } -#endif // QT_CONFIG(openssl) void tst_QSslSocket::disconnectFromHostWhenConnecting() {