autotests: Fix TestXdgShellClient

This commit is contained in:
Vlad Zahorodnii 2021-02-01 09:59:02 +02:00
parent 21eee7de18
commit 230b560ffc
3 changed files with 9 additions and 7 deletions

View file

@ -125,13 +125,13 @@ void TestXdgShellClient::testXdgWindowReactive()
QVERIFY(rootClient); QVERIFY(rootClient);
QVERIFY(childClient); QVERIFY(childClient);
QSignalSpy frameGeometryChangedSpy(childClient, &AbstractClient::frameGeometryChanged); QSignalSpy popupConfigureRequested(popup.data(), &Test::XdgPopup::configureRequested);
QVERIFY(frameGeometryChangedSpy.isValid()); QVERIFY(popupConfigureRequested.isValid());
rootClient->move(rootClient->x()+20, rootClient->y()+20); rootClient->move(rootClient->x()+20, rootClient->y()+20);
QVERIFY(frameGeometryChangedSpy.wait()); QVERIFY(popupConfigureRequested.wait());
QCOMPARE(frameGeometryChangedSpy.count(), 1); QCOMPARE(popupConfigureRequested.count(), 1);
} }
void TestXdgShellClient::testXdgWindowRepositioning() void TestXdgShellClient::testXdgWindowRepositioning()

View file

@ -1707,7 +1707,7 @@ XdgPopupClient::XdgPopupClient(XdgPopupInterface *shellSurface)
this, &XdgPopupClient::destroyClient); this, &XdgPopupClient::destroyClient);
} }
void XdgPopupClient::handlePositionerBindings() void XdgPopupClient::updateReactive()
{ {
if (m_shellSurface->positioner().isReactive()) { if (m_shellSurface->positioner().isReactive()) {
connect(transientFor(), &AbstractClient::frameGeometryChanged, connect(transientFor(), &AbstractClient::frameGeometryChanged,
@ -1720,7 +1720,7 @@ void XdgPopupClient::handlePositionerBindings()
void XdgPopupClient::handleRepositionRequested(quint32 token) void XdgPopupClient::handleRepositionRequested(quint32 token)
{ {
handlePositionerBindings(); updateReactive();
m_shellSurface->sendRepositioned(token); m_shellSurface->sendRepositioned(token);
relayout(); relayout();
} }
@ -2012,6 +2012,8 @@ void XdgPopupClient::initialize()
parentClient->addTransient(this); parentClient->addTransient(this);
setTransientFor(parentClient); setTransientFor(parentClient);
updateReactive();
blockGeometryUpdates(true); blockGeometryUpdates(true);
const QRect area = workspace()->clientArea(PlacementArea, Screens::self()->current(), desktop()); const QRect area = workspace()->clientArea(PlacementArea, Screens::self()->current(), desktop());
placeIn(area); placeIn(area);

View file

@ -248,10 +248,10 @@ protected:
private: private:
void handleGrabRequested(KWaylandServer::SeatInterface *seat, quint32 serial); void handleGrabRequested(KWaylandServer::SeatInterface *seat, quint32 serial);
void handlePositionerBindings();
void handleRepositionRequested(quint32 token); void handleRepositionRequested(quint32 token);
void initialize(); void initialize();
void relayout(); void relayout();
void updateReactive();
KWaylandServer::XdgPopupInterface *m_shellSurface; KWaylandServer::XdgPopupInterface *m_shellSurface;
bool m_haveExplicitGrab = false; bool m_haveExplicitGrab = false;