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.
This commit is contained in:
Aleix Pol 2021-05-08 00:26:21 +02:00 committed by Aleix Pol Gonzalez
parent 9577423dfa
commit 8cfa30803b

View file

@ -837,11 +837,18 @@ void InternalWindowTest::testDismissPopup()
auto serverPopup = clientAddedSpy.last().first().value<InternalClient *>(); auto serverPopup = clientAddedSpy.last().first().value<InternalClient *>();
QVERIFY(serverPopup); 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<InternalClient *>();
QVERIFY(serverOtherToplevel);
// Click somewhere outside the popup window. // Click somewhere outside the popup window.
QSignalSpy popupClosedSpy(serverPopup, &InternalClient::windowClosed); QSignalSpy popupClosedSpy(serverPopup, &InternalClient::windowClosed);
quint32 timestamp = 0; quint32 timestamp = 0;
kwinApp()->platform()->pointerMotion(QPointF(serverPopup->x() + serverPopup->width() + 1, kwinApp()->platform()->pointerMotion(serverOtherToplevel->frameGeometry().center(),
serverPopup->y() + serverPopup->height() + 1),
timestamp++); timestamp++);
kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++); kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++);
QTRY_COMPARE(popupClosedSpy.count(), 1); QTRY_COMPARE(popupClosedSpy.count(), 1);