Test setup for tests that require events?
-
I need to test QNetworkRequest objects, or the usage thereof. I am not sure exactly of what happens under the hood as far as events go.
The questions:
Do I need an event loop to test the networking system?
Is there a test setup for event based testing?The default test setups seem to be very basic and do not provide event loops, that I can tell. At least in Qt 5.9.7. We are running Qt Creator 4.7.2 if that makes any difference. I originally ran into an issue trying to test QTimer. It would not function in tests with no event loop.
-
The act of typing the question out helped me know what to do. If I want to test events I should run the event loop myself by calling QCoreApplication::processEvents() in my test. Yes, it was sort of obvious.
Thanks for your help! Hopefully this will help someone else.