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.8 6.5
Change-Id: Ib0d54d47e74d4c3b70637bef95fa81d4da83dd76
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit b724c3708bfd94e2f3ec01ccec8de6779f0adb33)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2025-04-02 05:47:42 +02:00 committed by Qt Cherry-pick Bot
parent a47b7c285d
commit 35431fe6e3

View File

@ -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<QDockWidget> 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()