diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2011-05-06 06:34:15 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2011-05-06 07:38:48 (GMT) |
commit | 8512dc16553ecf511c40a2ba7a815f777d7d5c59 (patch) | |
tree | ddd4847aaec7fe08c4139fc60b8a2b4446ede447 /tests/auto | |
parent | 7cb0a3baeb361c9909e8ab2caf436e8e44b6a3b6 (diff) | |
download | Qt-8512dc16553ecf511c40a2ba7a815f777d7d5c59.zip Qt-8512dc16553ecf511c40a2ba7a815f777d7d5c59.tar.gz Qt-8512dc16553ecf511c40a2ba7a815f777d7d5c59.tar.bz2 |
Remove Q_ASSERT from QMetaType autotest
Replace Q_ASSERT in helper class with code to count failures and report
meaningful warnings. The test function then fails the test if any
failures were recorded.
Change-Id: I0d6650e6036c8e45729c16d1dbb7543b4fb42553
Task-number: QTBUG-17582
Reviewed-by: Rohan McGovern
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qmetatype/tst_qmetatype.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/auto/qmetatype/tst_qmetatype.cpp b/tests/auto/qmetatype/tst_qmetatype.cpp index fcb949f..ccf0ac5 100644 --- a/tests/auto/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/qmetatype/tst_qmetatype.cpp @@ -96,10 +96,18 @@ struct Bar Bar() { // check re-entrancy - Q_ASSERT(QMetaType::isRegistered(qRegisterMetaType<Foo>("Foo"))); + if (!QMetaType::isRegistered(qRegisterMetaType<Foo>("Foo"))) { + qWarning("%s: re-entrancy test failed", Q_FUNC_INFO); + ++failureCount; + } } + +public: + static int failureCount; }; +int Bar::failureCount = 0; + class MetaTypeTorturer: public QThread { Q_OBJECT @@ -161,6 +169,7 @@ void tst_QMetaType::threadSafety() QCOMPARE(t1.failureCount, 0); QCOMPARE(t2.failureCount, 0); QCOMPARE(t3.failureCount, 0); + QCOMPARE(Bar::failureCount, 0); } namespace TestSpace |