tst_QNetworkProxyFactory cleanup genericSystemProxy skipping

Instead of having Q_UNUSED and QSKIP in the test itself, we just skip in
the _data function.

Change-Id: I9da3d3104ec25e2645e5770e6392bd46958da072
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
bb10
Mårten Nordheim 2022-03-30 12:00:00 +02:00
parent fd803a6d04
commit f08fd3c055
1 changed files with 5 additions and 10 deletions

View File

@ -256,8 +256,6 @@ void tst_QNetworkProxyFactory::genericSystemProxy()
QFETCH(QString, hostName);
QFETCH(int, port);
// We can only use the generic system proxy where available:
#if !defined(Q_OS_WIN) && !defined(Q_OS_MACOS) && !defined(Q_OS_ANDROID) && !QT_CONFIG(libproxy)
qputenv(envVar, url);
const QList<QNetworkProxy> systemProxy = QNetworkProxyFactory::systemProxyForQuery();
QCOMPARE(systemProxy.size(), 1);
@ -265,18 +263,14 @@ void tst_QNetworkProxyFactory::genericSystemProxy()
QCOMPARE(systemProxy.first().hostName(), hostName);
QCOMPARE(systemProxy.first().port(), static_cast<quint16>(port));
qunsetenv(envVar);
#else
Q_UNUSED(envVar);
Q_UNUSED(url);
Q_UNUSED(proxyType);
Q_UNUSED(hostName);
Q_UNUSED(port);
QSKIP("Generic system proxy not available on this platform.");
#endif
}
void tst_QNetworkProxyFactory::genericSystemProxy_data()
{
// We can only use the generic system proxy where available:
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS) || defined(Q_OS_ANDROID) || QT_CONFIG(libproxy)
QSKIP("Generic system proxy not available on this platform.");
#else
QTest::addColumn<QByteArray>("envVar");
QTest::addColumn<QByteArray>("url");
QTest::addColumn<QNetworkProxy::ProxyType>("proxyType");
@ -289,6 +283,7 @@ void tst_QNetworkProxyFactory::genericSystemProxy_data()
<< QNetworkProxy::Socks5Proxy << QString("127.0.0.1") << 4242;
QTest::newRow("http") << QByteArray("http_proxy") << QByteArray("http://example.com:666")
<< QNetworkProxy::HttpProxy << QString("example.com") << 666;
#endif
}
class QSPFQThread : public QThread