summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/util.h
diff options
context:
space:
mode:
authorDavid Faure <david.faure@kdab.com>2016-10-23 20:22:52 +0200
committerDavid Faure <david.faure@kdab.com>2016-11-29 15:06:18 +0000
commitc0950098f3a7d4994ff07b06b8ff32e2a60ee7bf (patch)
tree30a76adcebee0dd93d63420eab125c148bac1423 /tests/auto/widgets/util.h
parent01c029fd90162bdbbcf9534537f26138a333c570 (diff)
Port autotests from own waitForSignal() to QSignalSpy::wait()
I added QSignalSpy::wait() in Qt 5.0 exactly for this purpose. Change-Id: I895a92f5f7e4e8554e00f6668e6973cc2c903adf Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests/auto/widgets/util.h')
-rw-r--r--tests/auto/widgets/util.h23
1 files changed, 0 insertions, 23 deletions
diff --git a/tests/auto/widgets/util.h b/tests/auto/widgets/util.h
index 770579f1f..356cf6ebb 100644
--- a/tests/auto/widgets/util.h
+++ b/tests/auto/widgets/util.h
@@ -42,29 +42,6 @@
#endif
/**
- * Starts an event loop that runs until the given signal is received.
- * Optionally the event loop
- * can return earlier on a timeout.
- *
- * \return \p true if the requested signal was received
- * \p false on timeout
- */
-static inline bool waitForSignal(QObject* obj, const char* signal, int timeout = 10000)
-{
- QEventLoop loop;
- QObject::connect(obj, signal, &loop, SLOT(quit()));
- QTimer timer;
- QSignalSpy timeoutSpy(&timer, SIGNAL(timeout()));
- if (timeout > 0) {
- QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
- timer.setSingleShot(true);
- timer.start(timeout);
- }
- loop.exec();
- return timeoutSpy.isEmpty();
-}
-
-/**
* Just like QSignalSpy but facilitates sync and async
* signal emission. For example if you want to verify that
* page->foo() emitted a signal, it could be that the