From: Jason McDonald Date: Tue, 3 May 2011 06:08:25 +0000 (+1000) Subject: Remove Q_ASSERT's from QWizard autotest X-Git-Tag: qt-v5.0.0-alpha1~4297^2~44 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=affdd6283c32e144b6c9d5f58b492eebf56e966e;p=profile%2Fivi%2Fqtbase.git Remove Q_ASSERT's from QWizard autotest Combine the two checking functions (check and checkInvariant) and have the resulting check function return a bool instead of asserting so that the test function can QVERIFY and fail gracefully. Change-Id: Ib069b5424483ba6ffb9caf75036c4f325e9dba51 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit a54900d2227bfb2021c5d1255817824aff11cf32) --- diff --git a/tests/auto/qwizard/tst_qwizard.cpp b/tests/auto/qwizard/tst_qwizard.cpp index 5667d40..00b59a9 100644 --- a/tests/auto/qwizard/tst_qwizard.cpp +++ b/tests/auto/qwizard/tst_qwizard.cpp @@ -854,25 +854,26 @@ struct MyPage2 : public QWizardPage public: MyPage2() : init(0), cleanup(0), validate(0) {} - void initializePage() { ++init; QWizardPage::initializePage(); checkInvariant(); } - void cleanupPage() { ++cleanup; QWizardPage::cleanupPage(); checkInvariant(); } + void initializePage() { ++init; QWizardPage::initializePage(); } + void cleanupPage() { ++cleanup; QWizardPage::cleanupPage(); } bool validatePage() { ++validate; return QWizardPage::validatePage(); } - void check(int init, int cleanup) - { Q_ASSERT(init == this->init && cleanup == this->cleanup); Q_UNUSED(init); Q_UNUSED(cleanup); } + bool check(int init, int cleanup) + { + return init == this->init + && cleanup == this->cleanup + && (this->init == this->cleanup || this->init - 1 == this->cleanup); + } int init; int cleanup; int validate; - -private: - void checkInvariant() { Q_ASSERT(init == cleanup || init - 1 == cleanup); } }; #define CHECK_PAGE_INIT(i0, c0, i1, c1, i2, c2) \ - page0->check((i0), (c0)); \ - page1->check((i1), (c1)); \ - page2->check((i2), (c2)); + QVERIFY(page0->check((i0), (c0))); \ + QVERIFY(page1->check((i1), (c1))); \ + QVERIFY(page2->check((i2), (c2))); void tst_QWizard::setOption_IndependentPages() {