summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAxel Spoerl <axel.spoerl@qt.io>2022-12-20 09:24:24 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-12-27 01:24:21 +0000
commitab1338914a49d93225ce4f5c6eddb0226d281a37 (patch)
tree6776ee3923a06b96f381c9c4c5ab7c142d58ebab /tests
parenta1fbf47cc8b928a8f456162c7191b936b9a8f9f1 (diff)
Stabilize tst_QSpinBox::sizeHint() by explicitly calling setLayout()
The test function places a QSpinBox in a QHBoxLayout, which has a QWidget parent. The spin box is expected to be shown with the widget. While the widget is the layout's parent, the layout is not explicitly set. That makes the test function flaky in some cases. This patch adds QWidget::setLayout() to explicitly set the layout on the widget. Change-Id: I3a1cc77c302c5ba96d3628d035139f9718dda9e5 Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit 8e6ede7cd131682161180bfab0cc46686674709b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
index c877454440..583cce9f7a 100644
--- a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
+++ b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
@@ -1151,6 +1151,7 @@ void tst_QSpinBox::sizeHint()
{
QWidget *widget = new QWidget;
QHBoxLayout *layout = new QHBoxLayout(widget);
+ widget->setLayout(layout);
sizeHint_SpinBox *spinBox = new sizeHint_SpinBox;
layout->addWidget(spinBox);
widget->show();