From 8cfa30803ba3378b5991dbc06b3fbf2b383230c4 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Sat, 8 May 2021 00:26:21 +0200 Subject: [PATCH] Fix InternalWindowTest::testDismissPopup We were expecting a tooltip to be closed when clicking its transientParent, but it's explicitly not something we are after. We close popups when we click either other clients or the actual client on the decoration. This change makes it so we end up clicking another window instead of the parent one that is unrelated. --- autotests/integration/internal_window.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/autotests/integration/internal_window.cpp b/autotests/integration/internal_window.cpp index 03a19d613f..a3b21ce592 100644 --- a/autotests/integration/internal_window.cpp +++ b/autotests/integration/internal_window.cpp @@ -837,11 +837,18 @@ void InternalWindowTest::testDismissPopup() auto serverPopup = clientAddedSpy.last().first().value(); QVERIFY(serverPopup); + //Create the other window to click + HelperWindow otherClientToplevel; + otherClientToplevel.setGeometry(100, 100, 100, 100); + otherClientToplevel.show(); + QTRY_COMPARE(clientAddedSpy.count(), 3); + auto serverOtherToplevel = clientAddedSpy.last().first().value(); + QVERIFY(serverOtherToplevel); + // Click somewhere outside the popup window. QSignalSpy popupClosedSpy(serverPopup, &InternalClient::windowClosed); quint32 timestamp = 0; - kwinApp()->platform()->pointerMotion(QPointF(serverPopup->x() + serverPopup->width() + 1, - serverPopup->y() + serverPopup->height() + 1), + kwinApp()->platform()->pointerMotion(serverOtherToplevel->frameGeometry().center(), timestamp++); kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); QTRY_COMPARE(popupClosedSpy.count(), 1);