From b724c3708bfd94e2f3ec01ccec8de6779f0adb33 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 2 Apr 2025 05:47:42 +0200 Subject: [PATCH] tst_QDockWidget: split setFloating() test function The test function contains two completely separate tests: The old setFloating() method from a910daf52678469b7e595da5fe54aa09ba2373c3^, and the additions of said commit, which don't reuse any objects of the old function. Turn the latter into a new test function, setFloatingReparenting(), to help code readers understand that these two parts of the test function have nothing in common. Case in point: setFloating() is now ubsan+asan-clean while setFloatingReparenting() inherits both asan and ubsan errors of the old, combined function. Amends a910daf52678469b7e595da5fe54aa09ba2373c3. Pick-to: 6.9 6.8 6.5 Change-Id: Ib0d54d47e74d4c3b70637bef95fa81d4da83dd76 Reviewed-by: Axel Spoerl --- .../widgets/widgets/qdockwidget/tst_qdockwidget.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp index 1762676ebdb..e7c6bc1cff5 100644 --- a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp +++ b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp @@ -42,6 +42,7 @@ private slots: void widget(); void features(); void setFloating(); + void setFloatingReparenting(); void allowedAreas(); void toggleViewAction(); void visibilityChanged(); @@ -463,8 +464,14 @@ void tst_QDockWidget::setFloating() dw.setFloating(dw.isFloating()); QCOMPARE(spy.size(), 0); spy.clear(); +} -#if defined(QT_BUILD_INTERNAL) && !defined(Q_OS_WIN) +void tst_QDockWidget::setFloatingReparenting() +{ +#ifdef Q_OS_WIN + QSKIP("Test skipped on Windows platforms"); +#endif // Q_OS_WIN +#ifdef QT_BUILD_INTERNAL // Check that setFloating() reparents the dock widget to the main window, // in case it has a QDockWidgetGroupWindow parent QPointer d1; @@ -479,7 +486,9 @@ void tst_QDockWidget::setFloating() d1->setFloating(true); QTRY_COMPARE(mainWindow, d1->parentWidget()); QTRY_COMPARE(mainWindow, d2->parentWidget()); -#endif // defined(QT_BUILD_INTERNAL) && !defined(Q_OS_WIN) +#else + QSKIP("test requires -developer-build option"); +#endif // defined(QT_BUILD_INTERNAL) } void tst_QDockWidget::allowedAreas()