I have successfully built a thin client/server using Qt\'s Tcp Sockets API. I know it works very well, because I have sent plenty of data over the wire and verified it. Howeve
While QTEST_MAIN
creates a QApplication and runs all your tests, it does so sequentially and not with an event loop. Therefore, while your socket can indeed connect to the server (meaning qTestSocket->waitForConnected()
returns true
), since the app doesn't return to an event loop, the QTcpServer
's signal will not get emitted, and TcpCommSocketTest::connectDummyServer()
never gets called.
Try adding a call to qApp->processEvents()
at the end of initTestCase()
. It should let connectDummyServer()
be called.