summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/text/qstring/tst_qstring.cpp6
-rw-r--r--tests/auto/gui/util/qshadergraph/tst_qshadergraph.cpp45
-rw-r--r--tests/auto/network-settings.h16
-rw-r--r--tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp13
-rw-r--r--tests/auto/network/socket/qtcpsocket/BLACKLIST7
-rw-r--r--tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp18
6 files changed, 85 insertions, 20 deletions
diff --git a/tests/auto/corelib/text/qstring/tst_qstring.cpp b/tests/auto/corelib/text/qstring/tst_qstring.cpp
index 9cb76a0130..7072cb9516 100644
--- a/tests/auto/corelib/text/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/text/qstring/tst_qstring.cpp
@@ -4706,6 +4706,12 @@ void tst_QString::fromUcs4()
s = QString::fromUcs4(U"\u221212\U000020AC\U00010000");
QCOMPARE(s, QString::fromUtf8("\342\210\222" "12" "\342\202\254" "\360\220\200\200"));
#endif
+
+ // QTBUG-62011: don't mistake ZWNBS for BOM
+ // Start with one BOM, to ensure we use the right endianness:
+ const uint text[] = { 0xfeff, 97, 0xfeff, 98, 0xfeff, 99, 0xfeff, 100 };
+ s = QString::fromUcs4(text, 8);
+ QCOMPARE(s, QStringView(u"a\xfeff" u"b\xfeff" u"c\xfeff" "d"));
}
void tst_QString::toUcs4()
diff --git a/tests/auto/gui/util/qshadergraph/tst_qshadergraph.cpp b/tests/auto/gui/util/qshadergraph/tst_qshadergraph.cpp
index ce2d38c24f..50c925a111 100644
--- a/tests/auto/gui/util/qshadergraph/tst_qshadergraph.cpp
+++ b/tests/auto/gui/util/qshadergraph/tst_qshadergraph.cpp
@@ -114,6 +114,7 @@ private slots:
void shouldSurviveCyclesDuringGraphSerialization();
void shouldDealWithEdgesJumpingOverLayers();
void shouldGenerateDifferentStatementsDependingOnActiveLayers();
+ void shouldDealWithBranchesWithoutOutput();
};
void tst_QShaderGraph::shouldHaveEdgeDefaultState()
@@ -774,6 +775,50 @@ void tst_QShaderGraph::shouldGenerateDifferentStatementsDependingOnActiveLayers(
}
}
+void tst_QShaderGraph::shouldDealWithBranchesWithoutOutput()
+{
+ // GIVEN
+ const auto input = createNode({
+ createPort(QShaderNodePort::Output, "input")
+ });
+ const auto output = createNode({
+ createPort(QShaderNodePort::Input, "output")
+ });
+ const auto danglingFunction = createNode({
+ createPort(QShaderNodePort::Input, "functionInput"),
+ createPort(QShaderNodePort::Output, "unbound")
+ });
+ const auto function = createNode({
+ createPort(QShaderNodePort::Input, "functionInput"),
+ createPort(QShaderNodePort::Output, "functionOutput")
+ });
+
+ const auto graph = [=] {
+ auto res = QShaderGraph();
+ res.addNode(input);
+ res.addNode(function);
+ res.addNode(danglingFunction);
+ res.addNode(output);
+ res.addEdge(createEdge(input.uuid(), "input", function.uuid(), "functionInput"));
+ res.addEdge(createEdge(input.uuid(), "input", danglingFunction.uuid(), "functionInput"));
+ res.addEdge(createEdge(function.uuid(), "functionOutput", output.uuid(), "output"));
+ return res;
+ }();
+
+ // WHEN
+ const auto statements = graph.createStatements();
+
+ // THEN
+ // Note that no edge leads to the unbound input
+ const auto expected = QVector<QShaderGraph::Statement>()
+ << createStatement(input, {}, {0})
+ << createStatement(function, {0}, {1})
+ << createStatement(output, {1}, {})
+ << createStatement(danglingFunction, {0}, {2});
+ dumpStatementsIfNeeded(statements, expected);
+ QCOMPARE(statements, expected);
+}
+
QTEST_MAIN(tst_QShaderGraph)
#include "tst_qshadergraph.moc"
diff --git a/tests/auto/network-settings.h b/tests/auto/network-settings.h
index 65d4bb5cea..641bf1d672 100644
--- a/tests/auto/network-settings.h
+++ b/tests/auto/network-settings.h
@@ -134,6 +134,22 @@ public:
return true;
}
+ static bool canBindToLowPorts()
+ {
+#ifdef Q_OS_UNIX
+ if (geteuid() == 0)
+ return true;
+ if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSMojave)
+ return true;
+ // ### Which versions of iOS, watchOS and such does Apple's opening of
+ // all ports apply to?
+ return false;
+#else
+ // Windows
+ return true;
+#endif
+ }
+
#ifdef QT_NETWORK_LIB
static bool verifyTestNetworkSettings()
diff --git a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp
index 5be00630ca..68c913ecfc 100644
--- a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp
+++ b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp
@@ -529,12 +529,11 @@ void tst_PlatformSocketEngine::tooManySockets()
//---------------------------------------------------------------------------
void tst_PlatformSocketEngine::bind()
{
-#if !defined Q_OS_WIN
PLATFORMSOCKETENGINE binder;
QVERIFY(binder.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol));
- QVERIFY(!binder.bind(QHostAddress::AnyIPv4, 82));
- QCOMPARE(binder.error(), QAbstractSocket::SocketAccessError);
-#endif
+ QCOMPARE(binder.bind(QHostAddress::AnyIPv4, 82), QtNetworkSettings::canBindToLowPorts());
+ if (!QtNetworkSettings::canBindToLowPorts())
+ QCOMPARE(binder.error(), QAbstractSocket::SocketAccessError);
PLATFORMSOCKETENGINE binder2;
QVERIFY(binder2.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol));
@@ -546,6 +545,12 @@ void tst_PlatformSocketEngine::bind()
QCOMPARE(binder3.error(), QAbstractSocket::AddressInUseError);
if (QtNetworkSettings::hasIPv6()) {
+ PLATFORMSOCKETENGINE binder;
+ QVERIFY(binder.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv6Protocol));
+ QCOMPARE(binder.bind(QHostAddress::AnyIPv6, 82), QtNetworkSettings::canBindToLowPorts());
+ if (!QtNetworkSettings::canBindToLowPorts())
+ QCOMPARE(binder.error(), QAbstractSocket::SocketAccessError);
+
PLATFORMSOCKETENGINE binder4;
QVERIFY(binder4.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv6Protocol));
QVERIFY(binder4.bind(QHostAddress::AnyIPv6, 31180));
diff --git a/tests/auto/network/socket/qtcpsocket/BLACKLIST b/tests/auto/network/socket/qtcpsocket/BLACKLIST
index 07532710b3..129e9f0b4e 100644
--- a/tests/auto/network/socket/qtcpsocket/BLACKLIST
+++ b/tests/auto/network/socket/qtcpsocket/BLACKLIST
@@ -1,10 +1,3 @@
-[bind]
-windows-10 msvc-2015
-windows-7sp1
-[bind:[::]]
-windows
-[bind:[::]:randomport]
-windows
[timeoutConnect:ip]
windows
# QTBUG-66247
diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
index 9ab5e88900..b29db90da4 100644
--- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
+++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
@@ -523,7 +523,7 @@ void tst_QTcpSocket::bind_data()
continue; // link-local bind will fail, at least on Linux, so skip it.
QString ip(entry.ip().toString());
- QTest::newRow(ip.toLatin1().constData()) << ip << 0 << true << ip;
+ QTest::addRow("%s:0", ip.toLatin1().constData()) << ip << 0 << true << ip;
if (!testIpv6 && entry.ip().protocol() == QAbstractSocket::IPv6Protocol)
testIpv6 = true;
@@ -531,9 +531,9 @@ void tst_QTcpSocket::bind_data()
}
// test binding to localhost
- QTest::newRow("0.0.0.0") << "0.0.0.0" << 0 << true << "0.0.0.0";
+ QTest::newRow("0.0.0.0:0") << "0.0.0.0" << 0 << true << "0.0.0.0";
if (testIpv6)
- QTest::newRow("[::]") << "::" << 0 << true << "::";
+ QTest::newRow("[::]:0") << "::" << 0 << true << "::";
// and binding with a port number...
// Since we want to test that we got the port number we asked for, we need a random port number.
@@ -551,16 +551,16 @@ void tst_QTcpSocket::bind_data()
knownBad << "198.51.100.1";
knownBad << "2001:0DB8::1";
foreach (const QString &badAddress, knownBad) {
- QTest::newRow(badAddress.toLatin1().constData()) << badAddress << 0 << false << QString();
+ QTest::addRow("%s:0", badAddress.toLatin1().constData()) << badAddress << 0 << false << QString();
}
-#ifdef Q_OS_UNIX
// try to bind to a privileged ports
// we should fail if we're not root (unless the ports are in use!)
- QTest::newRow("127.0.0.1:1") << "127.0.0.1" << 1 << !geteuid() << (geteuid() ? QString() : "127.0.0.1");
+ QTest::newRow("127.0.0.1:1") << "127.0.0.1" << 1 << QtNetworkSettings::canBindToLowPorts()
+ << (QtNetworkSettings::canBindToLowPorts() ? "127.0.0.1" : QString());
if (testIpv6)
- QTest::newRow("[::]:1") << "::" << 1 << !geteuid() << (geteuid() ? QString() : "::");
-#endif
+ QTest::newRow("[::]:1") << "::" << 1 << QtNetworkSettings::canBindToLowPorts()
+ << (QtNetworkSettings::canBindToLowPorts() ? "::" : QString());
}
void tst_QTcpSocket::bind()
@@ -585,7 +585,7 @@ void tst_QTcpSocket::bind()
if (successExpected) {
bool randomPort = port == -1;
- int attemptsLeft = 5; // only used with randomPort
+ int attemptsLeft = 5; // only used with randomPort or Windows
do {
if (randomPort) {
// try to get a random port number