diff options
Diffstat (limited to 'tests/auto/network-settings.h')
-rw-r--r-- | tests/auto/network-settings.h | 77 |
1 files changed, 47 insertions, 30 deletions
diff --git a/tests/auto/network-settings.h b/tests/auto/network-settings.h index 4dd6ce897b..33b29f105c 100644 --- a/tests/auto/network-settings.h +++ b/tests/auto/network-settings.h @@ -1,33 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QString> -#include <QtTest/QtTest> +#include <QTest> +#include <QOperatingSystemVersion> +#include <QStringBuilder> #ifdef QT_NETWORK_LIB #include <QtNetwork/QHostInfo> #include <QtNetwork/QHostAddress> @@ -115,7 +92,11 @@ public: static bool hasIPv6() { -#ifdef Q_OS_UNIX +#if defined(Q_OS_QNX) + // Qt's support for IPv6 on QNX appears to be broken. + // This is an unaccepable situation after 2011-01-31. + return false; +#elif defined(Q_OS_UNIX) int s = ::socket(AF_INET6, SOCK_DGRAM, 0); if (s == -1) return false; @@ -262,6 +243,41 @@ public: #endif } + static QString hostWithServiceOnPort(int port) + { +#if !defined(QT_TEST_SERVER) + Q_UNUSED(port); + return serverName(); +#else + switch (port) { + case 13: + case 22: + case 139: + return serverName(); // No such things in docker (yet?) + case 7: + return echoServerName(); + case 21: + return ftpServerName(); + case 80: + case 443: + return httpServerName(); + case 143: + return imapServerName(); + case 3128: + case 3129: + case 3130: + return httpProxyServerName(); + case 1080: + case 1081: + return socksProxyServerName(); + case 2121: + return ftpProxyServerName(); + default: + return serverName(); + } +#endif // QT_TEST_SERVER + } + #ifdef QT_NETWORK_LIB static QHostAddress imapServerIp() { @@ -297,5 +313,6 @@ public: { return getServerIpImpl(firewallServerName()); } -#endif + +#endif // QT_NETWORK_LIB }; |