From 04402947a439b9fb2c325fe528c2bbee3324be5f Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Mon, 18 Sep 2023 22:30:17 +0100 Subject: [PATCH] tests: Add another test for #360 The bug happens with normal non-nested main windows as well. Closing a main window and then reshowing it will show with all its dock widgets hidden --- tests/tst_docks.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/tst_docks.cpp b/tests/tst_docks.cpp index e6a0f6937..a42642078 100644 --- a/tests/tst_docks.cpp +++ b/tests/tst_docks.cpp @@ -2672,6 +2672,28 @@ KDDW_QCORO_TASK tst_marginsAfterRestore() KDDW_TEST_RETURN(true); } +KDDW_QCORO_TASK tst_mainWindowToggle() +{ + EnsureTopLevelsDeleted e; + auto m = createMainWindow(Size(500, 500), {}, "tst_marginsAfterRestore"); + auto dock1 = createDockWidget("1", Platform::instance()->tests_createView({ true })); + m->addDockWidget(dock1, Location_OnLeft); + CHECK(dock1->isOpen()); + CHECK(m->isVisible()); + + m->close(); + CHECK(!m->isVisible()); + CHECK(!dock1->isOpen()); + Platform::instance()->tests_wait(1000); + m->setVisible(true); + CHECK(m->isVisible()); + + /// TODO: uncomment once #360 is fixed + // CHECK(dock1->isOpen()); + + KDDW_TEST_RETURN(true); +} + KDDW_QCORO_TASK tst_restoreWithNewDockWidgets() { // Tests that if the LayoutSaver doesn't know about some dock widget @@ -5450,6 +5472,7 @@ static const auto s_tests = std::vector TEST(tst_point), TEST(tst_rect), TEST(tst_resizeInLayout), + TEST(tst_mainWindowToggle), #if !defined(KDDW_FRONTEND_FLUTTER) TEST(tst_doesntHaveNativeTitleBar), TEST(tst_sizeAfterRedock),