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 <timur.pocheptsov@qt.io>
bb10
Mårten Nordheim 2021-06-24 18:28:06 +02:00
parent edc9a294a6
commit 773b37fb38
1 changed files with 2 additions and 4 deletions

View File

@ -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()
{