Hi all,
inside a library I have code like:
QNetworkReply* AIDAW::getRequest(const QString& url){
QNetworkRequest request(url);
QNetworkReply *reply = this->network_manager->get(request);
QObject::connect(reply,
SIGNAL(finished
()),
&loop,
SLOT(quit
()));
QObject::connect(&timer,
SIGNAL(timeout
()),
&loop,
SLOT(quit
()));
timer.start(TIMEOUT);
loop.exec();
if(timer.isActive() == false){
//manage the timeout
}
return reply;
}
QNetworkReply* AIDAW::getRequest(const QString& url){
QEventLoop loop;
QTimer timer;
QNetworkRequest request(url);
QNetworkReply *reply = this->network_manager->get(request);
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
timer.start(TIMEOUT);
loop.exec();
if(timer.isActive() == false){
//manage the timeout
}
return reply;
}
To copy to clipboard, switch view to plain text mode
If I try to write a QTest Project using this library I get this error:
********* Start testing of MyProject *********
Config: Using QTest library 4.7.0, Qt 4.7.0
PASS : AIDATest::initTestCase()
QObject::connect: Cannot
connect (null)::aboutToQuit() to QNativeWifiEngine
::clo seHandle()
********* Start testing of MyProject *********
Config: Using QTest library 4.7.0, Qt 4.7.0
PASS : AIDATest::initTestCase()
QEventLoop: Cannot be used without QApplication
QObject::connect: Cannot connect (null)::aboutToQuit() to QNativeWifiEngine::clo
seHandle()
QObject::startTimer: QTimer can only be used with threads started with QThread
QObject::startTimer: QTimer can only be used with threads started with QThread
To copy to clipboard, switch view to plain text mode
the main of the test project is managed by QTEST_MAIN(MyTestClass) macro
Bookmarks