Reduce usage of Q_ASSERT in autotests.
Using Q_ASSERT does nothing in release-mode builds, and in debug builds it causes tests to terminate prematurely. It is much better to use QVERIFY or QCOMPARE. Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit 3475168550c1a804f04f2a4edfeb30c04cd36551)
This commit is contained in:
parent
939ef5eb38
commit
11baecf600
|
@ -368,7 +368,7 @@ void tst_QDeclarativeDebug::initTestCase()
|
|||
for (int i=0; i<qml.count(); i++) {
|
||||
QDeclarativeComponent component(m_engine);
|
||||
component.setData(qml[i], QUrl::fromLocalFile(""));
|
||||
Q_ASSERT(component.isReady()); // fails if bad syntax
|
||||
QVERIFY(component.isReady()); // fails if bad syntax
|
||||
m_components << qobject_cast<QDeclarativeItem*>(component.create());
|
||||
}
|
||||
m_rootItem = qobject_cast<QDeclarativeItem*>(m_components.first());
|
||||
|
@ -382,7 +382,7 @@ void tst_QDeclarativeDebug::initTestCase()
|
|||
|
||||
QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Connection established");
|
||||
bool ok = m_conn->waitForConnected();
|
||||
Q_ASSERT(ok);
|
||||
QVERIFY(ok);
|
||||
QTRY_VERIFY(QDeclarativeDebugService::hasDebuggingClient());
|
||||
m_dbg = new QDeclarativeEngineDebug(m_conn, this);
|
||||
QTRY_VERIFY(m_dbg->status() == QDeclarativeEngineDebug::Enabled);
|
||||
|
@ -483,11 +483,11 @@ void tst_QDeclarativeDebug::watch_object()
|
|||
QDeclarativeDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this);
|
||||
waitForQuery(q_engines);
|
||||
|
||||
Q_ASSERT(q_engines->engines().count() > 0);
|
||||
QVERIFY(q_engines->engines().count() > 0);
|
||||
QDeclarativeDebugRootContextQuery *q_context = m_dbg->queryRootContexts(q_engines->engines()[0].debugId(), this);
|
||||
waitForQuery(q_context);
|
||||
|
||||
Q_ASSERT(q_context->rootContext().objects().count() > 0);
|
||||
QVERIFY(q_context->rootContext().objects().count() > 0);
|
||||
QDeclarativeDebugObjectQuery *q_obj = m_dbg->queryObject(q_context->rootContext().objects()[0], this);
|
||||
waitForQuery(q_obj);
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ void tst_QDeclarativeDebugClient::initTestCase()
|
|||
|
||||
QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Connection established");
|
||||
bool ok = m_conn->waitForConnected();
|
||||
Q_ASSERT(ok);
|
||||
QVERIFY(ok);
|
||||
|
||||
QTRY_VERIFY(QDeclarativeDebugService::hasDebuggingClient());
|
||||
QTRY_COMPARE(client.status(), QDeclarativeDebugClient::Enabled);
|
||||
|
|
|
@ -87,7 +87,7 @@ void tst_QDeclarativeDebugService::initTestCase()
|
|||
|
||||
QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Connection established");
|
||||
bool ok = m_conn->waitForConnected();
|
||||
Q_ASSERT(ok);
|
||||
QVERIFY(ok);
|
||||
|
||||
QTRY_VERIFY(QDeclarativeDebugService::hasDebuggingClient());
|
||||
}
|
||||
|
|
|
@ -55,13 +55,13 @@
|
|||
#endif
|
||||
|
||||
class tst_qdeclarativefontloader : public QObject
|
||||
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
tst_qdeclarativefontloader();
|
||||
|
||||
private slots:
|
||||
void init();
|
||||
void noFont();
|
||||
void namedFont();
|
||||
void localFont();
|
||||
|
@ -71,8 +71,6 @@ private slots:
|
|||
void failWebFont();
|
||||
void changeFont();
|
||||
|
||||
private slots:
|
||||
|
||||
private:
|
||||
QDeclarativeEngine engine;
|
||||
TestHTTPServer server;
|
||||
|
@ -82,7 +80,11 @@ tst_qdeclarativefontloader::tst_qdeclarativefontloader() :
|
|||
server(SERVER_PORT)
|
||||
{
|
||||
server.serveDirectory(SRCDIR "/data");
|
||||
Q_ASSERT(server.isValid());
|
||||
}
|
||||
|
||||
void tst_qdeclarativefontloader::init()
|
||||
{
|
||||
QVERIFY(server.isValid());
|
||||
}
|
||||
|
||||
void tst_qdeclarativefontloader::noFont()
|
||||
|
|
Loading…
Reference in New Issue