diff options
author | David Faure <david.faure@kdab.com> | 2013-11-18 20:00:16 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-20 09:03:09 +0100 |
commit | e1c0a1b56cddcbab91e4d0fc325482b51c55e3d1 (patch) | |
tree | 45f854dc450bcef6c1e1bdf17ce4ca2ae0e34fcd | |
parent | cefa54d478fa69d1482602ff442af45bb73c5a7f (diff) |
QProgressDialog: add unittest for the auto-show feature
Change-Id: I244d0b740467a09e8833f4debb95b19e45df371f
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
-rw-r--r-- | tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp index 68502f0d8d..060fa51293 100644 --- a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp +++ b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp @@ -57,6 +57,8 @@ public: virtual ~tst_QProgressDialog(); private slots: + void autoShow_data(); + void autoShow(); void getSetCheck(); void task198202(); void QTBUG_31046(); @@ -70,6 +72,34 @@ tst_QProgressDialog::~tst_QProgressDialog() { } +void tst_QProgressDialog::autoShow_data() +{ + QTest::addColumn<int>("min"); + QTest::addColumn<int>("max"); + QTest::addColumn<int>("delay"); + QTest::addColumn<bool>("expectedAutoShow"); + + QTest::newRow("50_to_100_long") << 50 << 100 << 100 << true; // 50*100ms = 5s + QTest::newRow("50_to_100_short") << 50 << 1 << 100 << false; // 50*1ms = 50ms + + QTest::newRow("0_to_100_long") << 0 << 100 << 100 << true; // 100*100ms = 10s + QTest::newRow("0_to_10_short") << 0 << 10 << 100 << false; // 10*100ms = 1s +} + +void tst_QProgressDialog::autoShow() +{ + QFETCH(int, min); + QFETCH(int, max); + QFETCH(int, delay); + QFETCH(bool, expectedAutoShow); + + QProgressDialog dlg("", "", min, max); + dlg.setValue(0); + QThread::msleep(delay); + dlg.setValue(min+1); + QCOMPARE(dlg.isVisible(), expectedAutoShow); +} + // Testing get/set functions void tst_QProgressDialog::getSetCheck() { |