diff --git a/src/controllers/DropArea.cpp b/src/controllers/DropArea.cpp index 4acfa4cc..421259b8 100644 --- a/src/controllers/DropArea.cpp +++ b/src/controllers/DropArea.cpp @@ -478,6 +478,7 @@ Controllers::DockWidget *DropArea::mdiDockWidgetWrapper() const Controllers::Group *DropArea::createCentralFrame(MainWindowOptions options) { Controllers::Group *group = nullptr; + if (options & MainWindowOption_HasCentralFrame) { FrameOptions groupOptions = FrameOption_IsCentralFrame; const bool hasPersistentCentralWidget = diff --git a/src/controllers/Group.cpp b/src/controllers/Group.cpp index 790437ca..15f361b8 100644 --- a/src/controllers/Group.cpp +++ b/src/controllers/Group.cpp @@ -636,6 +636,8 @@ bool Group::hasTabsVisible() const QStringList Group::affinities() const { if (isEmpty()) { + if (auto m = mainWindow()) + return m->affinities(); return {}; } else { return dockWidgetAt(0)->affinities(); diff --git a/tests/tst_docks.cpp b/tests/tst_docks.cpp index fd1f7654..c311630f 100644 --- a/tests/tst_docks.cpp +++ b/tests/tst_docks.cpp @@ -6415,24 +6415,15 @@ void TestDocks::tst_closeTabOfCentralFrame() QVERIFY(group->isVisible()); } -void TestDocks::tst_centralFrame245() +void TestDocks::tst_centralGroupAffinity() { - /* + auto m = + createMainWindow(QSize(500, 500), MainWindowOption_HasCentralFrame, "tst_centralFrame245"); + const QStringList affinities = { "a" }; + m->setAffinities(affinities); - Build: -DKDDockWidgets_DEVELOPER_MODE=ON - Run: ./bin/tst_docks tst_centralFrame245 -platform xcb - - auto m = createMainWindow(QSize(500, 500), MainWindowOption_HasCentralFrame, - "tst_centralFrame245"); auto dock1 = createDockWidget("1", - Platform::instance()->tests_createView({ true })); auto dock2 = createDockWidget("2", - Platform::instance()->tests_createView({ true })); - - m->addDockWidgetAsTab(dock1); - m->addDockWidgetAsTab(dock2); - - QTest::qWait(100000); - -*/ + Group *centralGroup = m->dropArea()->m_centralFrame; + QCOMPARE(centralGroup->affinities(), affinities); } void TestDocks::tst_persistentCentralWidget() diff --git a/tests/tst_docks.h b/tests/tst_docks.h index 51da7c99..abdfb12a 100644 --- a/tests/tst_docks.h +++ b/tests/tst_docks.h @@ -111,7 +111,7 @@ private Q_SLOTS: void tst_availableLengthForOrientation(); void tst_closeShowWhenNoCentralFrame(); void tst_closeTabOfCentralFrame(); - void tst_centralFrame245(); + void tst_centralGroupAffinity(); void tst_setAsCurrentTab(); void tst_placeholderDisappearsOnReadd(); void tst_placeholdersAreRemovedProperly();