From 4e8a9ff8edca86cee6808e4f5be0cae0aff5faba Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Thu, 20 May 2021 18:28:23 +0100 Subject: [PATCH] tests: fix a flaky test on Windows The drop area doesn't fill the floating window, so the center was off and the drop didn't happen Additionally, disabled AeroSnap, for debugging purposes, so we can actually see the window moving, otherwise it doesn't move, since we can't fake a native drag. It's just a visual bonus, doesn't affect the correctness. --- tests/tst_docks.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/tst_docks.cpp b/tests/tst_docks.cpp index 87c2e6e4..3692cd5f 100644 --- a/tests/tst_docks.cpp +++ b/tests/tst_docks.cpp @@ -2428,7 +2428,6 @@ void TestDocks::tst_setFloatingWhenWasTabbed() m->addDockWidgetAsTab(dock1); m->addDockWidgetAsTab(dock2); - qDebug() << "6."; dock2->setFloating(true); QVERIFY(dock1->isTabbed()); QVERIFY(!dock2->isTabbed()); @@ -2537,6 +2536,8 @@ void TestDocks::tst_setFloatingWhenSideBySide() void TestDocks::tst_dockWindowWithTwoSideBySideFramesIntoCenter() { EnsureTopLevelsDeleted e; + KDDockWidgets::Config::self().setInternalFlags(KDDockWidgets::Config::InternalFlag_NoAeroSnap); + KDDockWidgets::Config::self().setFlags({}); auto m = createMainWindow(); auto fw = createFloatingWindow(); @@ -2548,7 +2549,10 @@ void TestDocks::tst_dockWindowWithTwoSideBySideFramesIntoCenter() auto fw2 = createFloatingWindow(); fw2->move(fw->x() + fw->width() + 100, fw->y()); - dragFloatingWindowTo(fw, fw2->geometry().center()); + auto da2 = fw2->dropArea(); + const QPoint dragDestPos = da2->mapToGlobal(da2->QWidgetAdapter::rect().center()); + + dragFloatingWindowTo(fw, dragDestPos); QVERIFY(fw2->dropArea()->checkSanity()); QCOMPARE(fw2->frames().size(), 1);