summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp')
-rw-r--r--tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp26
1 files changed, 9 insertions, 17 deletions
diff --git a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
index 3c4ab690db..27343edcde 100644
--- a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
+++ b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <qdebug.h>
#include <qapplication.h>
@@ -927,7 +927,6 @@ void tst_QSpinBox::editingFinished()
layout->addWidget(box2);
testFocusWidget.show();
- QApplicationPrivate::setActiveWindow(&testFocusWidget);
QVERIFY(QTest::qWaitForWindowActive(&testFocusWidget));
box->activateWindow();
box->setFocus();
@@ -1106,7 +1105,6 @@ void tst_QSpinBox::specialValue()
spin.setValue(50);
topWidget.show();
//make sure we have the focus (even if editingFinished fails)
- QApplicationPrivate::setActiveWindow(&topWidget);
topWidget.activateWindow();
QVERIFY(QTest::qWaitForWindowActive(&topWidget));
spin.setFocus();
@@ -1152,33 +1150,32 @@ public:
void tst_QSpinBox::sizeHint()
{
- QWidget *widget = new QWidget;
- QHBoxLayout *layout = new QHBoxLayout(widget);
+ QWidget widget;
+ QHBoxLayout *layout = new QHBoxLayout(&widget);
+
sizeHint_SpinBox *spinBox = new sizeHint_SpinBox;
layout->addWidget(spinBox);
- widget->show();
- QVERIFY(QTest::qWaitForWindowExposed(widget));
+ // Make sure all layout requests posted by the QHBoxLayout constructor and addWidget
+ // are processed before the widget is shown
+ QCoreApplication::sendPostedEvents(&widget, QEvent::LayoutRequest);
+ widget.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&widget));
// Prefix
spinBox->sizeHintRequests = 0;
spinBox->setPrefix(QLatin1String("abcdefghij"));
- qApp->processEvents();
QTRY_VERIFY(spinBox->sizeHintRequests > 0);
// Suffix
spinBox->sizeHintRequests = 0;
spinBox->setSuffix(QLatin1String("abcdefghij"));
- qApp->processEvents();
QTRY_VERIFY(spinBox->sizeHintRequests > 0);
// Range
spinBox->sizeHintRequests = 0;
spinBox->setRange(0, 1234567890);
spinBox->setValue(spinBox->maximum());
- qApp->processEvents();
QTRY_VERIFY(spinBox->sizeHintRequests > 0);
-
- delete widget;
}
void tst_QSpinBox::taskQTBUG_5008_textFromValueAndValidate()
@@ -1211,7 +1208,6 @@ void tst_QSpinBox::taskQTBUG_5008_textFromValueAndValidate()
spinbox.show();
spinbox.activateWindow();
spinbox.setFocus();
- QApplicationPrivate::setActiveWindow(&spinbox);
QVERIFY(QTest::qWaitForWindowActive(&spinbox));
QVERIFY(spinbox.hasFocus());
QTRY_COMPARE(static_cast<QWidget *>(&spinbox), QApplication::activeWindow());
@@ -1831,10 +1827,6 @@ void tst_QSpinBox::stepModifierPressAndHold()
spin.setStyle(stepModifierStyle.data());
QSignalSpy spy(&spin, &SpinBox::valueChanged);
- // TODO: remove debug output when QTBUG-69492 is fixed
- connect(&spin, &SpinBox::valueChanged, [=]() {
- qDebug() << QTime::currentTime() << "valueChanged emitted";
- });
spin.show();
QVERIFY(QTest::qWaitForWindowActive(&spin));