qsignalspy

QSignalSpy::wait(…) fails, when QTest::qWait(…) succeeds

巧了我就是萌 提交于 2019-12-24 03:27:55
问题 It's a confusing situation i'm in. While testing state transitions for a QStateMachine, the following code fails to spy on the signal that causes the transition. // Test transition to SS_STARTING QSignalSpy spy(test_obj_, SIGNAL(StateChanged(int))); // emmit StateChanged signal test_obj_->SetState(SS_STARTING); // Current state property should be SS_STARTING QVERIFY(spy.wait()); //<--- fails test QVERIFY(test_obj_->GetCurrentState() == SS_STARTING); QCOMPARE(spy.count(), 1); The following