diff options
Diffstat (limited to 'tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp')
-rw-r--r-- | tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp | 49 |
1 files changed, 18 insertions, 31 deletions
diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index 0ee3255502..62286bedb6 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -63,17 +63,11 @@ class tst_QUdpSocket : public QObject { Q_OBJECT -public: - tst_QUdpSocket(); - virtual ~tst_QUdpSocket(); - - -public slots: +private slots: void initTestCase_data(); void initTestCase(); void init(); void cleanup(); -private slots: void constructing(); void unconnectedServerAndClientTest(); void broadcasting(); @@ -144,14 +138,6 @@ static QHostAddress makeNonAny(const QHostAddress &address, QHostAddress::Specia return address; } -tst_QUdpSocket::tst_QUdpSocket() -{ -} - -tst_QUdpSocket::~tst_QUdpSocket() -{ -} - void tst_QUdpSocket::initTestCase_data() { // hack: we only enable the Socks5 over UDP tests on the old @@ -1119,12 +1105,13 @@ void tst_QUdpSocket::multicastTtlOption_data() addresses += QHostAddress(QHostAddress::AnyIPv6); foreach (const QHostAddress &address, addresses) { - QTest::newRow(QString("%1 0").arg(address.toString()).toLatin1()) << address << 0 << 0; - QTest::newRow(QString("%1 1").arg(address.toString()).toLatin1()) << address << 1 << 1; - QTest::newRow(QString("%1 2").arg(address.toString()).toLatin1()) << address << 2 << 2; - QTest::newRow(QString("%1 128").arg(address.toString()).toLatin1()) << address << 128 << 128; - QTest::newRow(QString("%1 255").arg(address.toString()).toLatin1()) << address << 255 << 255; - QTest::newRow(QString("%1 1024").arg(address.toString()).toLatin1()) << address << 1024 << 1; + const QByteArray addressB = address.toString().toLatin1(); + QTest::newRow((addressB + " 0").constData()) << address << 0 << 0; + QTest::newRow((addressB + " 1").constData()) << address << 1 << 1; + QTest::newRow((addressB + " 2").constData()) << address << 2 << 2; + QTest::newRow((addressB + " 128").constData()) << address << 128 << 128; + QTest::newRow((addressB + " 255").constData()) << address << 255 << 255; + QTest::newRow((addressB + " 1024").constData()) << address << 1024 << 1; } } @@ -1163,13 +1150,14 @@ void tst_QUdpSocket::multicastLoopbackOption_data() addresses += QHostAddress(QHostAddress::AnyIPv6); foreach (const QHostAddress &address, addresses) { - QTest::newRow(QString("%1 0").arg(address.toString()).toLatin1()) << address << 0 << 0; - QTest::newRow(QString("%1 1").arg(address.toString()).toLatin1()) << address << 1 << 1; - QTest::newRow(QString("%1 2").arg(address.toString()).toLatin1()) << address << 2 << 1; - QTest::newRow(QString("%1 0 again").arg(address.toString()).toLatin1()) << address << 0 << 0; - QTest::newRow(QString("%1 2 again").arg(address.toString()).toLatin1()) << address << 2 << 1; - QTest::newRow(QString("%1 0 last time").arg(address.toString()).toLatin1()) << address << 0 << 0; - QTest::newRow(QString("%1 1 again").arg(address.toString()).toLatin1()) << address << 1 << 1; + const QByteArray addressB = address.toString().toLatin1(); + QTest::newRow((addressB + " 0").constData()) << address << 0 << 0; + QTest::newRow((addressB + " 1").constData()) << address << 1 << 1; + QTest::newRow((addressB + " 2").constData()) << address << 2 << 1; + QTest::newRow((addressB + " 0 again").constData()) << address << 0 << 0; + QTest::newRow((addressB + " 2 again").constData()) << address << 2 << 1; + QTest::newRow((addressB + " 0 last time").constData()) << address << 0 << 0; + QTest::newRow((addressB + " 1 again").constData()) << address << 1 << 1; } } @@ -1266,9 +1254,8 @@ void tst_QUdpSocket::setMulticastInterface_data() if ((iface.flags() & QNetworkInterface::IsUp) == 0) continue; foreach (const QNetworkAddressEntry &entry, iface.addressEntries()) { - QTest::newRow(QString("%1:%2").arg(iface.name()).arg(entry.ip().toString()).toLatin1()) - << iface - << entry.ip(); + const QByteArray testName = iface.name().toLatin1() + ':' + entry.ip().toString().toLatin1(); + QTest::newRow(testName.constData()) << iface << entry.ip(); } } } |