summaryrefslogtreecommitdiffstats
path: root/tests/auto/q3progressbar
diff options
context:
space:
mode:
authorMartin Smith <msmith@trolltech.com>2009-09-11 08:36:23 (GMT)
committerMartin Smith <msmith@trolltech.com>2009-09-11 08:37:17 (GMT)
commitd753c7bc9028a97887d2c67f989d468cda39e1c6 (patch)
tree667e89e0b4fa6e20ae4df9ddf867b1969676ab1c /tests/auto/q3progressbar
parent3fd024c6d9f0b0998efc44a783ee8390c6494dfa (diff)
downloadQt-d753c7bc9028a97887d2c67f989d468cda39e1c6.zip
Qt-d753c7bc9028a97887d2c67f989d468cda39e1c6.tar.gz
Qt-d753c7bc9028a97887d2c67f989d468cda39e1c6.tar.bz2
Fixed a bug in the autotest for q3progressbar.
The "standard" test would sometimes fail (Mac OS X) because extra paint events could be generated, which would cause paintNumber to be > 1. Comparing it to 1 would fail. This test should be redesigned, I think.
Diffstat (limited to 'tests/auto/q3progressbar')
-rw-r--r--tests/auto/q3progressbar/tst_q3progressbar.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/auto/q3progressbar/tst_q3progressbar.cpp b/tests/auto/q3progressbar/tst_q3progressbar.cpp
index c5485a7..34a95d3 100644
--- a/tests/auto/q3progressbar/tst_q3progressbar.cpp
+++ b/tests/auto/q3progressbar/tst_q3progressbar.cpp
@@ -93,11 +93,15 @@ class MyCustomProgressBar : public Q3ProgressBar
void paintEvent(QPaintEvent * event)
{
paintNumber++;
+ qDebug() << "PAINT EVENT:" << paintNumber;
Q3ProgressBar::paintEvent(event);
}
int paintNumber;
};
+/*
+ Maybe this test should be redesigned.
+ */
void tst_Q3ProgressBar::setProgress()
{
MyCustomProgressBar * m_progressBar = new MyCustomProgressBar();
@@ -111,15 +115,21 @@ void tst_Q3ProgressBar::setProgress()
m_progressBar->setProgress(m_progressBar->progress() + 1);
QCOMPARE(oldValue + 1,m_progressBar->progress());
QApplication::processEvents();
- QVERIFY(m_progressBar->paintNumber >= 1); //it might be more than 1 because it is animated
+ // It might be > 1 because it is animated.
+ QVERIFY(m_progressBar->paintNumber >= 1);
+ qDebug() << "Animation test: paintNumber =" << m_progressBar->paintNumber;
+
//standard case
m_progressBar->setTotalSteps(3);
m_progressBar->setProgress(0);
m_progressBar->paintNumber = 0;
m_progressBar->setProgress(m_progressBar->progress() + 1);
QApplication::processEvents();
- QCOMPARE(m_progressBar->paintNumber,1);
+
+ // It might be > 1 because other events might cause painting.
+ QVERIFY(m_progressBar->paintNumber >= 1);
+ qDebug() << "Standard test: paintNumber =" << m_progressBar->paintNumber;
}
QTEST_MAIN(tst_Q3ProgressBar)