/** * Check that all mandatory informations are passed * throught the requestFinished signal... */ void Ut_AboutBusinessLogic::testMultiThread () { QSignalSpy spy ( m_Api, SIGNAL (requestFinished (AboutBusinessLogic::requestType, QVariant))); /* * Run the multithreaded data collection ... */ m_Api->start (); /* * Hopefully this does not harm, and enough... */ QTest::qWait (500); QList<AboutBusinessLogic::requestType> mandatoryFields; mandatoryFields << AboutBusinessLogic::reqProdName << AboutBusinessLogic::reqSwName << AboutBusinessLogic::reqLicense << AboutBusinessLogic::reqOsVersion << AboutBusinessLogic::reqImei << AboutBusinessLogic::reqWifiAddr; /* BtAddr also mandatory, but we stubbed that stuff here, * and we have a separate testcase which covers that one... */ /* * Check whether that at least the mandatory field values are arrived */ QVERIFY (spy.count () >= mandatoryFields.count ()); QList<AboutBusinessLogic::requestType> arrivedFields; for ( ; ! spy.isEmpty () ; ) { QList<QVariant> signal = spy.takeFirst (); arrivedFields << signal.at (0).value<AboutBusinessLogic::requestType>(); } foreach (AboutBusinessLogic::requestType req, mandatoryFields) { //SYS_DEBUG ("reqNr = %d", (int) req); QVERIFY (arrivedFields.contains (req)); }