QLocal{Socket,Server}: extend the test coverage for property bindings
The pre-existing test for QLocalServer was testing only a minor subset of cases, so replace it with the call to QTestPrivate::testReadWritePropertyBasics. The test for QLocalSocket's bindable properties was missing, so add it. The new tests didn't reveal any problems. Task-number: QTBUG-116346 Change-Id: I695bb050d39eeae9ffb84c097c36601a4ca89af6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 1ad424aed502386c97359b65f37edf2966c0dfa6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
75dc131a28
commit
b34073eab5
@ -10,5 +10,6 @@ qt_internal_add_test(tst_qlocalsocket
|
||||
QLOCALSOCKET_DEBUG
|
||||
LIBRARIES
|
||||
Qt::Network
|
||||
Qt::TestPrivate
|
||||
)
|
||||
add_dependencies(tst_qlocalsocket socketprocess)
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include <QTest>
|
||||
#include <QSignalSpy>
|
||||
#include <QtTest/private/qpropertytesthelper_p.h>
|
||||
#if QT_CONFIG(process)
|
||||
#include <QProcess>
|
||||
#endif
|
||||
@ -123,6 +124,7 @@ private slots:
|
||||
void verifyListenWithDescriptor_data();
|
||||
|
||||
void serverBindingsAndProperties();
|
||||
void socketBindings();
|
||||
|
||||
protected slots:
|
||||
void socketClosedSlot();
|
||||
@ -1807,14 +1809,18 @@ void tst_QLocalSocket::serverBindingsAndProperties()
|
||||
{
|
||||
CrashSafeLocalServer server;
|
||||
|
||||
QProperty<QLocalServer::SocketOptions> sockOpts;
|
||||
server.bindableSocketOptions().setBinding(Qt::makePropertyBinding(sockOpts));
|
||||
sockOpts = QLocalServer::GroupAccessOption | QLocalServer::UserAccessOption;
|
||||
QCOMPARE(server.socketOptions(), sockOpts.value());
|
||||
QTestPrivate::testReadWritePropertyBasics(
|
||||
server, QLocalServer::SocketOptions{QLocalServer::GroupAccessOption},
|
||||
QLocalServer::SocketOptions{QLocalServer::OtherAccessOption}, "socketOptions");
|
||||
}
|
||||
|
||||
sockOpts.setBinding(server.bindableSocketOptions().makeBinding());
|
||||
server.setSocketOptions(QLocalServer::OtherAccessOption);
|
||||
QCOMPARE(sockOpts.value(), QLocalServer::OtherAccessOption);
|
||||
void tst_QLocalSocket::socketBindings()
|
||||
{
|
||||
QLocalSocket socket;
|
||||
|
||||
QTestPrivate::testReadWritePropertyBasics(
|
||||
socket, QLocalSocket::SocketOptions{QLocalSocket::AbstractNamespaceOption},
|
||||
QLocalSocket::SocketOptions{QLocalSocket::NoOptions}, "socketOptions");
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QLocalSocket)
|
||||
|
Loading…
x
Reference in New Issue
Block a user