summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp
index 6f527e7b6b..2149ee7c44 100644
--- a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp
+++ b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp
@@ -53,6 +53,7 @@ private Q_SLOTS:
void QTBUG_31046();
void settingCustomWidgets();
void i18n();
+ void setValueReentrancyGuard();
};
void tst_QProgressDialog::cleanup()
@@ -291,5 +292,28 @@ void tst_QProgressDialog::i18n()
QVERIFY(!btn->text().startsWith(xxx));
}
+void tst_QProgressDialog::setValueReentrancyGuard()
+{
+ // Tests setValue() of window modal QProgressBar with
+ // Qt::QueuedConnection:
+ // This test crashes with a stack overflow if the boolean
+ // guard "processingEvents" that prevents reentranct calls
+ // to QCoreApplication::processEvents() within setValue()
+ // has not been implemented
+
+ constexpr int steps = 100; // Should be at least 50 to test for crash
+
+ QProgressDialog dlg("Testing setValue reentrancy guard...", QString(), 0, steps);
+ dlg.setWindowModality(Qt::WindowModal);
+ dlg.setMinimumDuration(0);
+ dlg.setAutoReset(false);
+
+ // Simulate a quick work loop
+ for (int i = 0; i <= steps; ++i)
+ QMetaObject::invokeMethod(&dlg, "setValue", Qt::QueuedConnection, Q_ARG(int, i));
+
+ QTRY_COMPARE(dlg.value(), steps);
+}
+
QTEST_MAIN(tst_QProgressDialog)
#include "tst_qprogressdialog.moc"