2014-05-29 22:16:33 +08:00
|
|
|
#ifndef SIGNALSPY_H
|
|
|
|
|
#define SIGNALSPY_H
|
|
|
|
|
|
2014-06-04 01:48:50 +08:00
|
|
|
namespace QAMQP {
|
|
|
|
|
namespace Test {
|
|
|
|
|
|
|
|
|
|
bool waitForSignal(QObject *obj, const char *signal, int delay)
|
|
|
|
|
{
|
|
|
|
|
QObject::connect(obj, signal, &QTestEventLoop::instance(), SLOT(exitLoop()));
|
|
|
|
|
QPointer<QObject> safe = obj;
|
|
|
|
|
|
|
|
|
|
QTestEventLoop::instance().enterLoop(delay);
|
|
|
|
|
if (!safe.isNull())
|
|
|
|
|
QObject::disconnect(safe, signal, &QTestEventLoop::instance(), SLOT(exitLoop()));
|
|
|
|
|
return !QTestEventLoop::instance().timeout();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Test
|
|
|
|
|
} // namespace QAMQP
|
2014-05-29 22:16:33 +08:00
|
|
|
#endif
|