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 51300566ff,
nor with 51300566ff itself, so this
has seemingly been fixed or worked around some other way in the
meantime.

Task-number: QTBUG-121398
Pick-to: 6.7
Change-Id: I299e7f4b71ebdb17870348a3d5b0c49a93228c8b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
bb10
Tor Arne Vestbø 2024-01-18 16:55:05 +01:00
parent b393b26c70
commit f85c988980
1 changed files with 10 additions and 5 deletions

View File

@ -5430,24 +5430,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();