I'm trying to verify the behavior of a state machine using Qt test framework. I simply don't get how I am supposed to tests Qt SCXML implementation. Sure there is QSignalSpy
, but that is only for signals/slops which do not require the event loop to run. What I essentially want to do is:
myStateMachine.submitEvent("MyEvent");
// Run event loop
// Check result
I tried to QCoreApplication::processEvents()
this sometimes worked, but sometimes also got stuck when calling processEvents()
. I guess I might triggered an infinite loop. Also googling did not help, but there must be a way to do this properly.