diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2023-05-11 09:57:11 -0700 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-05-12 02:19:16 +0000 |
commit | a05787ab8566c36409c860e081008f84042a659b (patch) | |
tree | 613daa035722509aaf952a0e3df026899c91cc8a /tests | |
parent | e3cc2487ce63cae42d8054b38fdb54abe8545007 (diff) |
tst_QDnsLookup: create a dedicated test for IDN
Instead of using initTestCase and QFETCH_GLOBAL, which make the rest of
the tests repeat themselves with IDN data, which isn't necessary.
Change-Id: I3e3bfef633af4130a03afffd175e2537ba89dc04
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 9f7b341aae0bcab47ed51a5238fde5be37edc6b3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp index d22d858b26..689abf38c7 100644 --- a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp +++ b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp @@ -9,12 +9,17 @@ #include <QtNetwork/QDnsLookup> #include <QtNetwork/QHostAddress> +using namespace Qt::StringLiterals; static const int Timeout = 15000; // 15s class tst_QDnsLookup: public QObject { Q_OBJECT + const QString normalDomain = u".test.qt-project.org"_s; + const QString idnDomain = u".alqualondë.test.qt-project.org"_s; + bool usingIdnDomain = false; + QString domainName(const QString &input); QString domainNameList(const QString &input); QStringList domainNameListAlternatives(const QString &input); @@ -24,6 +29,9 @@ public slots: private slots: void lookup_data(); void lookup(); + void lookupIdn_data() { lookup_data(); } + void lookupIdn(); + void lookupReuse(); void lookupAbortRetry(); void bindingsAndProperties(); @@ -31,9 +39,6 @@ private slots: void tst_QDnsLookup::initTestCase() { - QTest::addColumn<QString>("tld"); - QTest::newRow("normal") << ".test.qt-project.org"; - QTest::newRow("idn") << ".alqualond\xc3\xab.test.qt-project.org"; } QString tst_QDnsLookup::domainName(const QString &input) @@ -47,8 +52,9 @@ QString tst_QDnsLookup::domainName(const QString &input) return nodot; } - QFETCH_GLOBAL(QString, tld); - return input + tld; + if (usingIdnDomain) + return input + idnDomain; + return input + normalDomain; } QString tst_QDnsLookup::domainNameList(const QString &input) @@ -291,6 +297,13 @@ void tst_QDnsLookup::lookup() QCOMPARE(texts.join(';'), txt); } +void tst_QDnsLookup::lookupIdn() +{ + usingIdnDomain = true; + lookup(); + usingIdnDomain = false; +} + void tst_QDnsLookup::lookupReuse() { QDnsLookup lookup; @@ -355,10 +368,6 @@ void tst_QDnsLookup::lookupAbortRetry() void tst_QDnsLookup::bindingsAndProperties() { - QFETCH_GLOBAL(const QString, tld); - if (tld == QStringLiteral("idn")) - return; - QDnsLookup lookup; lookup.setType(QDnsLookup::A); |