diff --git a/tests/blackcore/expect.h b/tests/blackcore/expect.h index 87e907484..81bef25ce 100644 --- a/tests/blackcore/expect.h +++ b/tests/blackcore/expect.h @@ -87,12 +87,13 @@ public: template ExpectUnit& expect(F1 signal, F2 slot) { auto subj = subject(); + auto next = [=]{ this->next(); }; m_expects.push_back([=]{ m_waitingFor = subj->metaObject()->className(); m_waitingFor += "::"; m_waitingFor += QMetaMethod::fromSignal(signal).name(); m_guard += QObject::connect(subj, signal, slot); - m_guard += QObject::connect(subj, signal, [=]{ next(); }); + m_guard += QObject::connect(subj, signal, next); }); return *this; }