summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/kernel')
-rw-r--r--tests/auto/widgets/kernel/qapplication/BLACKLIST4
-rw-r--r--tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp4
-rw-r--r--tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp12
-rw-r--r--tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp4
-rw-r--r--tests/auto/widgets/kernel/qwidget/BLACKLIST40
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp57
-rw-r--r--tests/auto/widgets/kernel/qwidget_window/BLACKLIST3
7 files changed, 89 insertions, 35 deletions
diff --git a/tests/auto/widgets/kernel/qapplication/BLACKLIST b/tests/auto/widgets/kernel/qapplication/BLACKLIST
index d7de7bf16e..ac65a97c40 100644
--- a/tests/auto/widgets/kernel/qapplication/BLACKLIST
+++ b/tests/auto/widgets/kernel/qapplication/BLACKLIST
@@ -1,4 +1,4 @@
[touchEventPropagation]
-# QTBUG-66745
-opensuse
opensuse-leap
+# QTBUG-66745
+opensuse-42.3
diff --git a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
index 8dd9d7c428..00bde3cb25 100644
--- a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
+++ b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
@@ -194,7 +194,7 @@ void tst_QBoxLayout::setGeometry()
setFrameless(&toplevel);
QWidget w(&toplevel);
QVBoxLayout *lay = new QVBoxLayout;
- lay->setMargin(0);
+ lay->setContentsMargins(0, 0, 0, 0);
lay->setSpacing(0);
QHBoxLayout *lay2 = new QHBoxLayout;
QDial *dial = new QDial;
@@ -271,7 +271,7 @@ void tst_QBoxLayout::widgetSurplus()
QDialog window;
QScopedPointer<MarginEatingStyle> marginEater(new MarginEatingStyle);
QVBoxLayout *vbox = new QVBoxLayout(&window);
- vbox->setMargin(0);
+ vbox->setContentsMargins(0, 0, 0, 0);
vbox->setSpacing(0);
QLabel *hiddenLabel = new QLabel(tr("Invisible label"));
diff --git a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
index 5e0327319b..1d63d140fb 100644
--- a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
+++ b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
@@ -219,9 +219,9 @@ void tst_QGridLayout::badDistributionBug()
QDialog dialog;
Ui::SortDialog ui;
ui.setupUi(&dialog);
- ui.gridLayout->setMargin(0);
+ ui.gridLayout->setContentsMargins(0, 0, 0, 0);
ui.gridLayout->setSpacing(0);
- ui.vboxLayout->setMargin(0);
+ ui.vboxLayout->setContentsMargins(0, 0, 0, 0);
ui.vboxLayout->setSpacing(0);
ui.okButton->setFixedHeight(20);
ui.moreButton->setFixedHeight(20);
@@ -237,7 +237,7 @@ void tst_QGridLayout::setMinAndMaxSize()
QWidget widget;
setFrameless(&widget);
QGridLayout layout(&widget);
- layout.setMargin(0);
+ layout.setContentsMargins(0, 0, 0, 0);
layout.setSpacing(0);
layout.setSizeConstraint(QLayout::SetMinAndMaxSize);
widget.show();
@@ -396,7 +396,7 @@ void tst_QGridLayout::spacingAndSpacers()
QWidget widget;
setFrameless(&widget);
QGridLayout layout(&widget);
- layout.setMargin(0);
+ layout.setContentsMargins(0, 0, 0, 0);
layout.setSpacing(0);
widget.show();
@@ -1541,7 +1541,7 @@ void tst_QGridLayout::spacerWithSpacing()
QWidget window;
QGridLayout layout(&window);
layout.setSpacing(1);
- layout.setMargin(0);
+ layout.setContentsMargins(0, 0, 0, 0);
populate(&layout, 0, i);
populate(&layout, 1, j);
populate(&layout, 2, k);
@@ -1651,7 +1651,7 @@ void tst_QGridLayout::taskQTBUG_52357_spacingWhenItemIsHidden()
QWidget widget;
setFrameless(&widget);
QGridLayout layout(&widget);
- layout.setMargin(0);
+ layout.setContentsMargins(0, 0, 0, 0);
layout.setSpacing(5);
QPushButton button1;
layout.addWidget(&button1, 0, 0);
diff --git a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp
index 936f581d89..140a367afe 100644
--- a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp
+++ b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp
@@ -308,7 +308,7 @@ void tst_QLayout::controlTypes2()
{
QWidget main;
QVBoxLayout *const layout = new QVBoxLayout(&main);
- layout->setMargin(0);
+ layout->setContentsMargins(0, 0, 0, 0);
QComboBox *combo = new QComboBox(&main);
layout->addWidget(combo);
QCOMPARE(layout->controlTypes(), QSizePolicy::ComboBox);
@@ -319,7 +319,7 @@ void tst_QLayout::adjustSizeShouldMakeSureLayoutIsActivated()
QWidget main;
QVBoxLayout *const layout = new QVBoxLayout(&main);
- layout->setMargin(0);
+ layout->setContentsMargins(0, 0, 0, 0);
SizeHinterFrame *frame = new SizeHinterFrame(QSize(200, 10), QSize(200, 8));
frame->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
layout->addWidget(frame);
diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST
index 03bec4286b..02e97e4b4e 100644
--- a/tests/auto/widgets/kernel/qwidget/BLACKLIST
+++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST
@@ -2,30 +2,34 @@
[normalGeometry]
ubuntu-16.04
[saveRestoreGeometry]
-xcb
+opensuse-leap
+ubuntu-16.04
b2qt
+opensuse-42.3
[restoreVersion1Geometry]
-osx
-[updateWhileMinimized]
ubuntu-16.04
+[updateWhileMinimized]
ubuntu-18.04
rhel-7.4
+ubuntu-16.04
rhel-7.6
-osx
[focusProxyAndInputMethods]
-linux
+ubuntu-16.04
+rhel-7.6
+opensuse-leap
+ubuntu-18.04
+rhel-7.4
+opensuse-42.3
[raise]
-# QTBUG-68175
-opensuse
opensuse-leap
-[setWindowGeometry]
-osx
-[windowMoveResize]
-osx
+# QTBUG-68175
+opensuse-42.3
[childEvents]
osx ci
[renderInvisible]
-osx
+osx-10.12
+osx-10.11
+osx-10.14
[optimizedResizeMove]
osx
[optimizedResize_topLevel]
@@ -40,12 +44,14 @@ opensuse
opensuse-leap
[moveInResizeEvent]
ubuntu-16.04
-[moveChild:right]
-osx
-[activateWindow]
-osx-10.12 ci
[multipleToplevelFocusCheck]
-linux
+ubuntu-16.04
+rhel-7.6
+opensuse-leap
+ubuntu-18.04
+rhel-7.4
+opensuse-42.3
[windowState]
# QTBUG-75270
winrt
+
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index 103be88f86..bfc2631842 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -182,6 +182,8 @@ private slots:
void tabOrderWithCompoundWidgets();
void tabOrderNoChange();
void tabOrderNoChange2();
+ void appFocusWidgetWithFocusProxyLater();
+ void appFocusWidgetWhenLosingFocusProxy();
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
void activation();
#endif
@@ -2032,6 +2034,51 @@ void tst_QWidget::tabOrderNoChange2()
QCOMPARE(focusChainBackward, getFocusChain(&w, false));
}
+void tst_QWidget::appFocusWidgetWithFocusProxyLater()
+{
+ // Given a lineedit without a focus proxy
+ QWidget window;
+ window.setWindowTitle(QTest::currentTestFunction());
+ QLineEdit *lineEditFocusProxy = new QLineEdit(&window);
+ QLineEdit *lineEdit = new QLineEdit(&window);
+ lineEdit->setFocus();
+ window.show();
+ QApplication::setActiveWindow(&window);
+ QVERIFY(QTest::qWaitForWindowActive(&window));
+ QCOMPARE(QApplication::focusWidget(), lineEdit);
+
+ // When setting a focus proxy for the focus widget (like QWebEngineView does)
+ lineEdit->setFocusProxy(lineEditFocusProxy);
+
+ // Then the focus widget should be updated
+ QCOMPARE(QApplication::focusWidget(), lineEditFocusProxy);
+
+ // So that deleting the lineEdit and later the window, doesn't crash
+ delete lineEdit;
+ QCOMPARE(QApplication::focusWidget(), nullptr);
+}
+
+void tst_QWidget::appFocusWidgetWhenLosingFocusProxy()
+{
+ // Given a lineedit with a focus proxy
+ QWidget window;
+ window.setWindowTitle(QTest::currentTestFunction());
+ QLineEdit *lineEditFocusProxy = new QLineEdit(&window);
+ QLineEdit *lineEdit = new QLineEdit(&window);
+ lineEdit->setFocusProxy(lineEditFocusProxy);
+ lineEdit->setFocus();
+ window.show();
+ QApplication::setActiveWindow(&window);
+ QVERIFY(QTest::qWaitForWindowActive(&window));
+ QCOMPARE(QApplication::focusWidget(), lineEditFocusProxy);
+
+ // When unsetting the focus proxy
+ lineEdit->setFocusProxy(nullptr);
+
+ // Then the application focus widget should be back to the lineedit
+ QCOMPARE(QApplication::focusWidget(), lineEdit);
+}
+
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
void tst_QWidget::activation()
{
@@ -6142,7 +6189,7 @@ void tst_QWidget::minAndMaxSizeWithX11BypassWindowManagerHint()
{
if (m_platform != QStringLiteral("xcb"))
QSKIP("This test is for X11 only.");
- // Same size as in QWidget::create_sys().
+ // Same size as in QWidgetPrivate::create.
const QSize desktopSize = QApplication::desktop()->size();
const QSize originalSize(desktopSize.width() / 2, desktopSize.height() * 4 / 10);
@@ -8026,7 +8073,7 @@ public:
sp.setHeightForWidth(hfwLayout);
QVBoxLayout *vbox = new QVBoxLayout;
- vbox->setMargin(0);
+ vbox->setContentsMargins(0, 0, 0, 0);
vbox->addWidget(new ASWidget(sizeHint + QSize(30, 20), sp, false, false));
setLayout(vbox);
}
@@ -9425,7 +9472,7 @@ void tst_QWidget::initialPosForDontShowOnScreenWidgets()
const QPoint expectedPos(0, 0);
QWidget widget;
widget.setAttribute(Qt::WA_DontShowOnScreen);
- widget.winId(); // Make sure create_sys is called.
+ widget.winId(); // Make sure QWidgetPrivate::create is called.
QCOMPARE(widget.pos(), expectedPos);
QCOMPARE(widget.geometry().topLeft(), expectedPos);
}
@@ -9435,7 +9482,7 @@ void tst_QWidget::initialPosForDontShowOnScreenWidgets()
QWidget widget;
widget.setAttribute(Qt::WA_DontShowOnScreen);
widget.move(expectedPos);
- widget.winId(); // Make sure create_sys is called.
+ widget.winId(); // Make sure QWidgetPrivate::create is called.
QCOMPARE(widget.pos(), expectedPos);
QCOMPARE(widget.geometry().topLeft(), expectedPos);
}
@@ -10073,7 +10120,7 @@ void tst_QWidget::grabMouse()
w.setObjectName(QLatin1String("tst_qwidget_grabMouse"));
w.setWindowTitle(w.objectName());
QLayout *layout = new QVBoxLayout(&w);
- layout->setMargin(50);
+ layout->setContentsMargins(50, 50, 50, 50);
GrabLoggerWidget *grabber = new GrabLoggerWidget(&log, &w);
const QString grabberObjectName = QLatin1String("tst_qwidget_grabMouse_grabber");
grabber->setObjectName(grabberObjectName);
diff --git a/tests/auto/widgets/kernel/qwidget_window/BLACKLIST b/tests/auto/widgets/kernel/qwidget_window/BLACKLIST
index 381cf76c46..39d7b695f6 100644
--- a/tests/auto/widgets/kernel/qwidget_window/BLACKLIST
+++ b/tests/auto/widgets/kernel/qwidget_window/BLACKLIST
@@ -4,4 +4,5 @@ opensuse-42.3
ubuntu-16.04
[setWindowState]
ubuntu-18.04
-rhel
+rhel-7.6
+