Hi, On Wednesday, January 18, 2017 10:16:30 Bob Hood wrote: > I'm trying to develop a unit test for an deferred signal; i.e. one that > won't be emitted until the event loop has been allowed to run. The case > looks like: > > void MyTest::user_info_deferred() > { > QVERIFY(qnam_class_ptr != nullptr); > > QSignalSpy spy(qnam_class_ptr, &QNAMClass::signal_userInfoReceived); > > // Retrieve account user information (deferred) > QCOMPARE(qname_class_ptr->userInfo(), true);
I think you need to insert a spy.wait(...) here. Give the event loop a chance to run... > QCOMPARE(spy.count(), 1); // make sure the signal was emitted > exactly one time > QNAMClassUser info = qvariant_cast<QNAMClassUser>(spy.at(0).at(0)); > } [cut] Konrad
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest