summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorTero Ahola <tero.ahola@digia.com>2011-11-10 15:40:47 (GMT)
committerFriedemann Kleint <Friedemann.Kleint@nokia.com>2011-11-10 15:40:47 (GMT)
commitb1998f4f59c3b10700963b2d13a17a0cc77ef665 (patch)
tree0a3d0ed1c9de3c76ef4b635aefd4cea6f8580a64 /tests/auto
parent72e61b127470b044e370af7017fa8a5b0538244f (diff)
downloadQt-b1998f4f59c3b10700963b2d13a17a0cc77ef665.zip
Qt-b1998f4f59c3b10700963b2d13a17a0cc77ef665.tar.gz
Qt-b1998f4f59c3b10700963b2d13a17a0cc77ef665.tar.bz2
Repaint QProgressBar when minimum or maximum changed
The implementation of QProgressBar::setMinimum and setMaximum did not repaint the widget. This caused the widget to be shown incorrectly in case you call setMinimum or setMaximum but not setValue. Task-number: QTBUG-22121 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qprogressbar/tst_qprogressbar.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/auto/qprogressbar/tst_qprogressbar.cpp b/tests/auto/qprogressbar/tst_qprogressbar.cpp
index 04b7ce7..878cce8 100644
--- a/tests/auto/qprogressbar/tst_qprogressbar.cpp
+++ b/tests/auto/qprogressbar/tst_qprogressbar.cpp
@@ -63,6 +63,7 @@ private slots:
void text();
void format();
void setValueRepaint();
+ void setMinMaxRepaint();
void sizeHint();
void formatedText_data();
void formatedText();
@@ -216,6 +217,44 @@ void tst_QProgressBar::setValueRepaint()
}
}
+void tst_QProgressBar::setMinMaxRepaint()
+{
+ ProgressBar pbar;
+ pbar.setMinimum(0);
+ pbar.setMaximum(10);
+ pbar.setFormat("%v");
+ pbar.show();
+ QTest::qWaitForWindowShown(&pbar);
+
+ QApplication::processEvents();
+
+ // No repaint when setting minimum to the current minimum
+ pbar.repainted = false;
+ pbar.setMinimum(0);
+ QTest::qWait(50);
+ QTRY_VERIFY(!pbar.repainted);
+
+ // No repaint when setting maximum to the current maximum
+ pbar.repainted = false;
+ pbar.setMaximum(10);
+ QTest::qWait(50);
+ QTRY_VERIFY(!pbar.repainted);
+
+ // Repaint when setting minimum
+ for (int i = 9; i >= 0; i--) {
+ pbar.repainted = false;
+ pbar.setMinimum(i);
+ QTRY_VERIFY(pbar.repainted);
+ }
+
+ // Repaint when setting maximum
+ for (int i = 0; i < 10; ++i) {
+ pbar.repainted = false;
+ pbar.setMaximum(i);
+ QTRY_VERIFY(pbar.repainted);
+ }
+}
+
void tst_QProgressBar::sizeHint()
{
ProgressBar bar;