From c8a543e3ecdddd9b5cf864885f10458966f3a7b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 18 Jan 2024 16:55:05 +0100 Subject: [PATCH] Simplify tst_QWidget::closeAndShowWithNativeChild The nativeHiddenChild is not used for anything, and shouldn't be needed to trigger the failure condition. That said, I was not able to reproduce the test failure on macOS 14 with the test neither pre or post patch, nor with any of the test cases mentioned in 51300566ffe2ece2455e1d0479a556c5dbb3bb8e, nor with 51300566ffe2ece2455e1d0479a556c5dbb3bb8e itself, so this has seemingly been fixed or worked around some other way in the meantime. Task-number: QTBUG-121398 Change-Id: I299e7f4b71ebdb17870348a3d5b0c49a93228c8b Reviewed-by: Axel Spoerl (cherry picked from commit f85c988980f73398762d4bd5c1a8a1799d182bdd) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index e01b9ca7594..dc4751704a6 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -5429,24 +5429,29 @@ void tst_QWidget::closeAndShowWithNativeChild() QApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); QWidget topLevel; + topLevel.setObjectName("TopLevel"); QWidget *nativeChild = new QWidget; + nativeChild->setObjectName("NativeChild"); nativeChild->setFixedSize(200, 200); - QWidget *nativeHiddenChild = new QWidget; - nativeHiddenChild->setFixedSize(200, 200); QWidget *normalChild = new QWidget; + normalChild->setObjectName("NormalChild"); normalChild->setFixedSize(200, 200); QHBoxLayout *layout = new QHBoxLayout; layout->addWidget(nativeChild); - layout->addWidget(nativeHiddenChild); layout->addWidget(normalChild); topLevel.setLayout(layout); - nativeHiddenChild->hide(); + nativeChild->setAttribute(Qt::WA_NativeWindow); + + QCOMPARE(normalChild->testAttribute(Qt::WA_WState_Hidden), false); + QCOMPARE(normalChild->testAttribute(Qt::WA_WState_ExplicitShowHide), false); + + QCOMPARE(nativeChild->testAttribute(Qt::WA_WState_Hidden), false); + QCOMPARE(nativeChild->testAttribute(Qt::WA_WState_ExplicitShowHide), false); topLevel.show(); QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); - nativeChild->winId(); const QSize originalSize = topLevel.size(); topLevel.close();