QProgressDialog: add unittest for the auto-show feature
Change-Id: I244d0b740467a09e8833f4debb95b19e45df371f Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
cefa54d478
commit
e1c0a1b56c
@ -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()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user