summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2023-05-11 09:57:11 -0700
committerThiago Macieira <thiago.macieira@intel.com>2023-05-11 17:05:25 -0700
commit9f7b341aae0bcab47ed51a5238fde5be37edc6b3 (patch)
treea109cdf8a64b10ca0ce1425860ed9fe2e2890049
parent68b625901f9eb7c34e3d7aa302e1c0a454d3190b (diff)
downloadqtbase-9f7b341aae0bcab47ed51a5238fde5be37edc6b3.tar.gz
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. Pick-to: 6.5 Change-Id: I3e3bfef633af4130a03afffd175e2537ba89dc04 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
-rw-r--r--tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp27
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 764fe9aee4..1b0829bdf0 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)
@@ -286,6 +292,13 @@ void tst_QDnsLookup::lookup()
QCOMPARE(texts.join(';'), txt);
}
+void tst_QDnsLookup::lookupIdn()
+{
+ usingIdnDomain = true;
+ lookup();
+ usingIdnDomain = false;
+}
+
void tst_QDnsLookup::lookupReuse()
{
QDnsLookup lookup;
@@ -340,10 +353,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);