diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2011-05-03 16:08:25 +1000 |
---|---|---|
committer | Rohan McGovern <rohan.mcgovern@nokia.com> | 2011-05-18 10:46:43 +1000 |
commit | affdd6283c32e144b6c9d5f58b492eebf56e966e (patch) | |
tree | 57c0a1a06afd2ad135f66d2d6a601dc710ab748a /tests/auto/qwizard | |
parent | 079dde144fd372ba76a5639fe69fca4e13c91ad7 (diff) |
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)
Diffstat (limited to 'tests/auto/qwizard')
-rw-r--r-- | tests/auto/qwizard/tst_qwizard.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/tests/auto/qwizard/tst_qwizard.cpp b/tests/auto/qwizard/tst_qwizard.cpp index 5667d4047a..00b59a923b 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() { |