aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2018-12-03 13:11:18 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2018-12-03 13:47:26 +0000
commit1fc2b12ffcf5ef0dd37e42326d8126aa29931a74 (patch)
tree18c0d81e61b78e743ac71dae620cbc1e1e1879c0 /tests
parent2e0771f1d694026ad99dc9a2c00a4c602c57edcf (diff)
SSH: Fix autotest
The SshX11InfoRetriever object must not be allocated on the stack, and the failure signal was potentially emitted too early for the test to catch it. Change-Id: Iac53546deee183c8f02bafdcc11a7910f3e392c0 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/ssh/tst_ssh.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/auto/ssh/tst_ssh.cpp b/tests/auto/ssh/tst_ssh.cpp
index 93b8a85c13..03cd1b2a95 100644
--- a/tests/auto/ssh/tst_ssh.cpp
+++ b/tests/auto/ssh/tst_ssh.cpp
@@ -849,7 +849,7 @@ void tst_Ssh::x11InfoRetriever()
QFETCH(QString, displayName);
QFETCH(bool, successExpected);
using namespace QSsh::Internal;
- SshX11InfoRetriever x11InfoRetriever(displayName);
+ auto * const x11InfoRetriever = new SshX11InfoRetriever(displayName);
QEventLoop loop;
bool success;
X11DisplayInfo displayInfo;
@@ -859,19 +859,19 @@ void tst_Ssh::x11InfoRetriever()
displayInfo = di;
loop.quit();
};
- connect(&x11InfoRetriever, &SshX11InfoRetriever::success, successHandler);
+ connect(x11InfoRetriever, &SshX11InfoRetriever::success, successHandler);
const auto failureHandler = [&loop, &success, &errorMessage](const QString &error) {
success = false;
errorMessage = error;
loop.quit();
};
- connect(&x11InfoRetriever, &SshX11InfoRetriever::failure, failureHandler);
+ connect(x11InfoRetriever, &SshX11InfoRetriever::failure, failureHandler);
QTimer timer;
QObject::connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit);
timer.setSingleShot(true);
timer.setInterval(40000);
timer.start();
- x11InfoRetriever.start();
+ x11InfoRetriever->start();
loop.exec();
QVERIFY(timer.isActive());
timer.stop();