diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2011-05-03 06:08:25 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2011-05-04 04:35:50 (GMT) |
commit | a54900d2227bfb2021c5d1255817824aff11cf32 (patch) | |
tree | b7885425ec6c9afcf2dd0333d7c09fd9a21f898e /tests/auto | |
parent | b2db13f245f09f1d14af64d2199284c78cbb5b6e (diff) | |
download | Qt-a54900d2227bfb2021c5d1255817824aff11cf32.zip Qt-a54900d2227bfb2021c5d1255817824aff11cf32.tar.gz Qt-a54900d2227bfb2021c5d1255817824aff11cf32.tar.bz2 |
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
Diffstat (limited to 'tests/auto')
-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 a813727..61eb8d4 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() { |