tst_QDnsLookup: extend test coverage for property bindings

The pre-existing tests were not using the QTestPrivate helpers, so
extend them with the call to QTestPrivate::testReadWritePropertyBasics.

The updated test didn't reveal any problems with binding loops, so no
other action is required for now.

Task-number: QTBUG-116346
Pick-to: 6.6 6.5
Change-Id: I51a17974a7f5bec3c969fcb55b6f28e3e9218eb5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Ivan Solovev 2023-08-28 14:34:44 +02:00
parent ac59fcdab8
commit 96a62cd1f5
2 changed files with 35 additions and 0 deletions

View File

@ -16,6 +16,7 @@ qt_internal_add_test(tst_qdnslookup
tst_qdnslookup.cpp
LIBRARIES
Qt::Network
Qt::TestPrivate
)
qt_internal_extend_target(tst_qdnslookup CONDITION WIN32

View File

@ -4,6 +4,7 @@
#include <QTest>
#include <QSignalSpy>
#include <QtTest/private/qpropertytesthelper_p.h>
#include <QtNetwork/QDnsLookup>
@ -51,6 +52,7 @@ private slots:
void setNameserver_data();
void setNameserver();
void bindingsAndProperties();
void automatedBindings();
};
static constexpr qsizetype HeaderSize = 6 * sizeof(quint16);
@ -643,5 +645,37 @@ void tst_QDnsLookup::bindingsAndProperties()
QCOMPARE(nameserverPortChangeSpy.size(), 1);
}
void tst_QDnsLookup::automatedBindings()
{
QDnsLookup lookup;
QTestPrivate::testReadWritePropertyBasics(lookup, u"aaaa"_s, u"txt"_s, "name");
if (QTest::currentTestFailed()) {
qDebug("Failed property test for QDnsLookup::name");
return;
}
QTestPrivate::testReadWritePropertyBasics(lookup, QDnsLookup::AAAA, QDnsLookup::TXT, "type");
if (QTest::currentTestFailed()) {
qDebug("Failed property test for QDnsLookup::type");
return;
}
QTestPrivate::testReadWritePropertyBasics(lookup, QHostAddress{QHostAddress::Any},
QHostAddress{QHostAddress::LocalHost},
"nameserver");
if (QTest::currentTestFailed()) {
qDebug("Failed property test for QDnsLookup::nameserver");
return;
}
QTestPrivate::testReadWritePropertyBasics(lookup, quint16(123), quint16(456),
"nameserverPort");
if (QTest::currentTestFailed()) {
qDebug("Failed property test for QDnsLookup::nameserverPort");
return;
}
}
QTEST_MAIN(tst_QDnsLookup)
#include "tst_qdnslookup.moc"