diff options
author | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2021-12-07 19:02:41 +0200 |
---|---|---|
committer | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2022-01-20 12:42:46 +0000 |
commit | 212c3c4f122ea921336137c7987a9c866c5cc347 (patch) | |
tree | b0b98f5edb468e7569c0d7bbe5042524efcc829d /tests/auto/installer/clientserver/tst_clientserver.cpp | |
parent | 766cd66f40f494642a1f83646299920e118eac4b (diff) |
RemoteObject: Fix warning on calling QLocalSocket::waitForDisconnected()
Change-Id: I1d5fdfedaee35c530b383951e6fc69b75bd67d64
Reviewed-by: Katja Marttila <katja.marttila@qt.io>
Diffstat (limited to 'tests/auto/installer/clientserver/tst_clientserver.cpp')
-rw-r--r-- | tests/auto/installer/clientserver/tst_clientserver.cpp | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/tests/auto/installer/clientserver/tst_clientserver.cpp b/tests/auto/installer/clientserver/tst_clientserver.cpp index 7b9971056..bcd87815d 100644 --- a/tests/auto/installer/clientserver/tst_clientserver.cpp +++ b/tests/auto/installer/clientserver/tst_clientserver.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2022 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -27,6 +27,7 @@ **************************************************************************/ #include "../shared/verifyinstaller.h" +#include "../shared/packagemanager.h" #include <protocol.h> #include <qprocesswrapper.h> @@ -51,6 +52,17 @@ using namespace QInstaller; +class MyRemoteObject : public RemoteObject +{ +public: + MyRemoteObject() + : RemoteObject(QLatin1String("MyRemoteObject")) {}; + + ~MyRemoteObject() = default; + + bool connectToServer() { return RemoteObject::connectToServer(); } +}; + class tst_ClientServer : public QObject { Q_OBJECT @@ -78,7 +90,7 @@ private: } private slots: - void initTestCase() + void init() { RemoteClient::instance().setActive(true); } @@ -269,6 +281,37 @@ private slots: } } + void testCreateDestroyRemoteObject() + { + RemoteServer server; + QString socketName = QUuid::createUuid().toString(); + server.init(socketName, QLatin1String("SomeKey"), Protocol::Mode::Production); + server.start(); + + RemoteClient::instance().init(socketName, QLatin1String("SomeKey"), Protocol::Mode::Debug, + Protocol::StartAs::User); + + // Look for warnings on connection and disconnection.. + qInstallMessageHandler(exitOnWarningMessageHandler); + + MyRemoteObject *object = new MyRemoteObject; + QVERIFY(!object->isConnectedToServer()); + delete object; + + object = new MyRemoteObject; + QVERIFY(object->connectToServer()); + QVERIFY(object->isConnectedToServer()); + delete object; + + object = new MyRemoteObject; + QVERIFY(object->connectToServer()); + QVERIFY(object->isConnectedToServer()); + + RemoteClient::instance().setActive(false); + QVERIFY(!object->isConnectedToServer()); + delete object; + } + void testQSettingsWrapper() { RemoteServer server; |