From 052d8680dc9172870f1c646586ab0bf971c5ba6a Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Wed, 13 Oct 2021 15:37:02 +0100 Subject: [PATCH] Add a test for #186 Was hard to reproduce, doesn't happen with many other layouts --- tests/tst_docks.cpp | 26 ++++++++++++++++++++++++++ tests/tst_docks.h | 1 + 2 files changed, 27 insertions(+) diff --git a/tests/tst_docks.cpp b/tests/tst_docks.cpp index c61a419d..6e4cb0ed 100644 --- a/tests/tst_docks.cpp +++ b/tests/tst_docks.cpp @@ -7327,6 +7327,32 @@ void TestDocks::tst_toggleTabbed2() QCOMPARE(frame1->title(), "dock1"); } +void TestDocks::tst_resizePropagatesEvenly() +{ + // For github issue #186 + // Usually resizing main window will resize dock widgets evenly, but if you resize multiple + // times then one dock widget is getting too small. Not repro with all layouts, but the following + // one reproduced it: + + auto m = createMainWindow(QSize(1000, 1000), MainWindowOption_None); + auto dock0 = createDockWidget("dock0", new MyWidget2()); + auto dock1 = createDockWidget("dock1", new MyWidget2()); + auto dock2 = createDockWidget("dock2", new MyWidget2()); + + m->addDockWidget(dock1, Location_OnLeft); + m->addDockWidget(dock2, Location_OnTop, dock1); + m->addDockWidget(dock0, Location_OnRight); + + QVERIFY(qAbs(dock2->height() - dock1->height()) < 2); + + m->resize(m->size() + QSize(0, 500)); + for (int i = 1; i < 10; ++i) + m->resize(m->size() - QSize(0, i)); + + QEXPECT_FAIL("", "Will fix", Continue); + QVERIFY(qAbs(dock2->height() - dock1->height()) < 2); +} + void TestDocks::tst_addMDIDockWidget() { EnsureTopLevelsDeleted e; diff --git a/tests/tst_docks.h b/tests/tst_docks.h index 55bd47e5..02451501 100644 --- a/tests/tst_docks.h +++ b/tests/tst_docks.h @@ -240,6 +240,7 @@ private Q_SLOTS: void tst_redocksToPreviousTabIndex(); void tst_toggleTabbed(); void tst_toggleTabbed2(); + void tst_resizePropagatesEvenly(); void tst_addMDIDockWidget(); void tst_redockToMDIRestoresPosition();