diff options
Diffstat (limited to 'tests/auto/network/kernel/qdnslookup')
-rw-r--r-- | tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp index fd1e8a1267..e13c80c719 100644 --- a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp +++ b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Jeremy Lainé <jeremy.laine@m4x.org> -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -170,6 +170,38 @@ void tst_QDnsLookup::lookup_data() QTest::newRow("txt-multi-multirr") << int(QDnsLookup::TXT) << "txt-multi-multirr" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "" << "" << "Hello;World"; } +static QByteArray msgDnsLookup(QDnsLookup::Error actualError, + int expectedError, + const QString &domain, + const QString &cname, + const QString &host, + const QString &srv, + const QString &mx, + const QString &ns, + const QString &ptr, + const QString &errorString) +{ + QString result; + QTextStream str(&result); + str << "Actual error: " << actualError; + if (!errorString.isEmpty()) + str << " (" << errorString << ')'; + str << ", expected: " << expectedError; + str << ", domain: " << domain; + if (!cname.isEmpty()) + str << ", cname: " << cname; + str << ", host: " << host; + if (!srv.isEmpty()) + str << " server: " << srv; + if (!mx.isEmpty()) + str << " mx: " << mx; + if (!ns.isEmpty()) + str << " ns: " << ns; + if (!ptr.isEmpty()) + str << " ptr: " << ptr; + return result.toLocal8Bit(); +} + void tst_QDnsLookup::lookup() { QFETCH(int, type); @@ -206,7 +238,8 @@ void tst_QDnsLookup::lookup() QEXPECT_FAIL("", "Not yet supported on Android", Abort); #endif - QVERIFY2(int(lookup.error()) == error, qPrintable(lookup.errorString())); + QVERIFY2(int(lookup.error()) == error, + msgDnsLookup(lookup.error(), error, domain, cname, host, srv, mx, ns, ptr, lookup.errorString())); if (error == QDnsLookup::NoError) QVERIFY(lookup.errorString().isEmpty()); QCOMPARE(int(lookup.type()), type); |