Spins the event loop until `spy` receives a signal or the timeout expires.
| 26 | |
| 27 | // Spins the event loop until `spy` receives a signal or the timeout expires. |
| 28 | bool waitForSignal(QSignalSpy& spy, int timeout_ms = 5000) { |
| 29 | QDeadlineTimer deadline(timeout_ms); |
| 30 | while (spy.isEmpty() && !deadline.hasExpired()) { |
| 31 | QCoreApplication::processEvents(QEventLoop::AllEvents, 50); |
| 32 | } |
| 33 | return !spy.isEmpty(); |
| 34 | } |
| 35 | |
| 36 | // Minimal loopback HTTP/1.1 server that replies to every request with a |
| 37 | // configurable status line + body. No external network required. |