diff --git a/src/private/quick/FrameQuick.cpp b/src/private/quick/FrameQuick.cpp index b85172a5..f35bc603 100644 --- a/src/private/quick/FrameQuick.cpp +++ b/src/private/quick/FrameQuick.cpp @@ -170,7 +170,7 @@ QVariant DockWidgetModel::data(const QModelIndex &index, int role) const DockWidgetBase *DockWidgetModel::dockWidgetAt(int index) const { if (index < 0 || index >= m_dockWidgets.size()) { - qWarning() << Q_FUNC_INFO << "Shouldn't happen" << index << m_dockWidgets.size(); + // Can happen. Benign. return nullptr; } diff --git a/tests/tst_common.cpp b/tests/tst_common.cpp index 50ef5119..f2a95d20 100644 --- a/tests/tst_common.cpp +++ b/tests/tst_common.cpp @@ -80,6 +80,7 @@ private Q_SLOTS: void tst_floatingWindowTitleBug(); void tst_resizeWindow_data(); void tst_resizeWindow(); + void tst_restoreCentralFrame(); }; void TestCommon::tst_simple1() @@ -442,6 +443,31 @@ void TestCommon::tst_resizeWindow() delete fw2; } +void TestCommon::tst_restoreCentralFrame() +{ + EnsureTopLevelsDeleted e; + auto m = createMainWindow(QSize(800, 500)); + auto layout = m->multiSplitter(); + + QCOMPARE(layout->count(), 1); + Item *item = m->dropArea()->centralFrame(); + QVERIFY(item); + auto frame = static_cast(item->guestAsQObject()); + QCOMPARE(frame->options(), FrameOption_IsCentralFrame | FrameOption_AlwaysShowsTabs); + QVERIFY(!frame->titleBar()->isVisible()); + + LayoutSaver saver; + QVERIFY(saver.saveToFile(QStringLiteral("layout_tst_restoreCentralFrame.json"))); + QVERIFY(saver.restoreFromFile(QStringLiteral("layout_tst_restoreCentralFrame.json"))); + + QCOMPARE(layout->count(), 1); + item = m->dropArea()->centralFrame(); + QVERIFY(item); + frame = static_cast(item->guestAsQObject()); + QCOMPARE(frame->options(), FrameOption_IsCentralFrame | FrameOption_AlwaysShowsTabs); + QVERIFY(!frame->titleBar()->isVisible()); +} + int main(int argc, char *argv[]) { if (!qpaPassedAsArgument(argc, argv)) { diff --git a/tests/tst_docks.cpp b/tests/tst_docks.cpp index 4f218b52..323cea6f 100644 --- a/tests/tst_docks.cpp +++ b/tests/tst_docks.cpp @@ -356,7 +356,6 @@ private Q_SLOTS: void tst_restoreSimplest(); void tst_restoreSimple(); void tst_restoreNestedAndTabbed(); - void tst_restoreCentralFrame(); void tst_restoreCrash(); void tst_restoreTwice(); void tst_restoreSideBySide(); @@ -1346,31 +1345,6 @@ void TestDocks::tst_restoreNestedAndTabbed() QCOMPARE(m->geometry(), oldGeo); } -void TestDocks::tst_restoreCentralFrame() -{ - EnsureTopLevelsDeleted e; - auto m = createMainWindow(QSize(800, 500)); - auto layout = m->multiSplitter(); - - QCOMPARE(layout->count(), 1); - Item *item = m->dropArea()->centralFrame(); - QVERIFY(item); - auto frame = static_cast(item->guestAsQObject()); - QCOMPARE(frame->options(), FrameOption_IsCentralFrame | FrameOption_AlwaysShowsTabs); - QVERIFY(!frame->titleBar()->isVisible()); - - LayoutSaver saver; - QVERIFY(saver.saveToFile(QStringLiteral("layout_tst_restoreCentralFrame.json"))); - QVERIFY(saver.restoreFromFile(QStringLiteral("layout_tst_restoreCentralFrame.json"))); - - QCOMPARE(layout->count(), 1); - item = m->dropArea()->centralFrame(); - QVERIFY(item); - frame = static_cast(item->guestAsQObject()); - QCOMPARE(frame->options(), FrameOption_IsCentralFrame | FrameOption_AlwaysShowsTabs); - QVERIFY(!frame->titleBar()->isVisible()); -} - void TestDocks::tst_restoreCrash() { EnsureTopLevelsDeleted e;