summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAxel Spoerl <axel.spoerl@qt.io>2023-05-16 10:40:13 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-06-07 16:47:08 +0000
commitb9c15d423384d8863bfa4e44f7609e5d732da551 (patch)
tree557b40624d14cf92cc810a3f7644e84f31c8373c /tests
parent4f57e9654eceb9fb27b1ee3f4ff83b7600540d74 (diff)
QDockWidget: Propagate window title when re-docking
When a floating dockwidget's title changes, it is rendered as a window title. When the title changes while floating, the change will be reverted to the pre-change title when the dockwidget is docked again. This patch explicitly propagates the window title, if it has been programmatically changed while the dock widget is floating. It adds test functionality in tst_QDockWidget::floatingTabs(). Fixes: QTBUG-113591 Change-Id: I96fa69fb27ad1a85f4ea9ce44c0a22290259fca6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit c153066baaa88718ed45b68230d81285eb436d3d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp
index 35a05f768a..97878e0887 100644
--- a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp
+++ b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp
@@ -65,7 +65,7 @@ private slots:
// Dock area permissions for DockWidgets and DockWidgetGroupWindows
void dockPermissions();
- // test floating tabs and item_tree consistency
+ // test floating tabs, item_tree and window title consistency
void floatingTabs();
// test hide & show
@@ -1375,7 +1375,10 @@ void tst_QDockWidget::floatingTabs()
/*
* replug both dock widgets into their initial position
- * expected behavior: both docks are plugged and no longer floating
+ * expected behavior:
+ - both docks are plugged
+ - both docks are no longer floating
+ - title changes have been propagated
*/
@@ -1396,6 +1399,12 @@ void tst_QDockWidget::floatingTabs()
QTRY_VERIFY(d1->isFloating());
QTRY_VERIFY(!d2->isFloating());
+ // Change titles
+ static constexpr QLatin1StringView newD1("New D1");
+ static constexpr QLatin1StringView newD2("New D2");
+ d1->setWindowTitle(newD1);
+ d2->setWindowTitle(newD2);
+
// Plug back into dock areas
qCDebug(lcTestDockWidget) << "*** test plugging back to dock areas ***";
qCDebug(lcTestDockWidget) << "Move d1 to left dock";
@@ -1415,6 +1424,10 @@ void tst_QDockWidget::floatingTabs()
QTRY_VERIFY(!mainWindow->findChild<QDockWidgetGroupWindow*>());
QTRY_VERIFY(ftabs.isNull());
+ // check window titles
+ QCOMPARE(d1->windowTitle(), newD1);
+ QCOMPARE(d2->windowTitle(), newD2);
+
// Check if paths are consistent
qCDebug(lcTestDockWidget) << "Checking path consistency" << layout->layoutState.indexOf(d1) << layout->layoutState.indexOf(d2);