Add client test for hiding the toplevel parent of a popup
This used to cause undefined behavior. Task-number: QTBUG-80562 Change-Id: I0397b7b304f316616d2a713063bc5a634dc081bc Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
parent
e86d199546
commit
d637993c5f
@ -46,6 +46,7 @@ private slots:
|
|||||||
void popup();
|
void popup();
|
||||||
void tooltipOnPopup();
|
void tooltipOnPopup();
|
||||||
void switchPopups();
|
void switchPopups();
|
||||||
|
void hidePopupParent();
|
||||||
void pongs();
|
void pongs();
|
||||||
void minMaxSize();
|
void minMaxSize();
|
||||||
void windowGeometry();
|
void windowGeometry();
|
||||||
@ -429,6 +430,50 @@ void tst_xdgshell::switchPopups()
|
|||||||
QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_xdgSurface->m_committedConfigureSerial);
|
QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_xdgSurface->m_committedConfigureSerial);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_xdgshell::hidePopupParent()
|
||||||
|
{
|
||||||
|
class Window : public QRasterWindow {
|
||||||
|
public:
|
||||||
|
void mousePressEvent(QMouseEvent *event) override
|
||||||
|
{
|
||||||
|
QRasterWindow::mousePressEvent(event);
|
||||||
|
m_popup.reset(new QRasterWindow);
|
||||||
|
m_popup->setTransientParent(this);
|
||||||
|
m_popup->setFlags(Qt::Popup);
|
||||||
|
m_popup->resize(100, 100);
|
||||||
|
m_popup->show();
|
||||||
|
}
|
||||||
|
QScopedPointer<QRasterWindow> m_popup;
|
||||||
|
};
|
||||||
|
Window window;
|
||||||
|
window.resize(200, 200);
|
||||||
|
window.show();
|
||||||
|
|
||||||
|
QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
|
||||||
|
exec([=] { xdgToplevel()->sendCompleteConfigure(); });
|
||||||
|
QCOMPOSITOR_TRY_VERIFY(xdgToplevel()->m_xdgSurface->m_committedConfigureSerial);
|
||||||
|
|
||||||
|
exec([=] {
|
||||||
|
auto *surface = xdgToplevel()->surface();
|
||||||
|
auto *p = pointer();
|
||||||
|
auto *c = client();
|
||||||
|
p->sendEnter(surface, {100, 100});
|
||||||
|
p->sendFrame(c);
|
||||||
|
p->sendButton(c, BTN_LEFT, Pointer::button_state_pressed);
|
||||||
|
p->sendButton(c, BTN_LEFT, Pointer::button_state_released);
|
||||||
|
p->sendFrame(c);
|
||||||
|
});
|
||||||
|
QCOMPOSITOR_TRY_VERIFY(xdgPopup());
|
||||||
|
exec([=] {
|
||||||
|
xdgPopup()->sendConfigure(QRect(100, 100, 100, 100));
|
||||||
|
xdgPopup()->m_xdgSurface->sendConfigure();
|
||||||
|
});
|
||||||
|
QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_xdgSurface->m_committedConfigureSerial);
|
||||||
|
|
||||||
|
window.hide();
|
||||||
|
QCOMPOSITOR_TRY_VERIFY(!xdgToplevel());
|
||||||
|
}
|
||||||
|
|
||||||
void tst_xdgshell::pongs()
|
void tst_xdgshell::pongs()
|
||||||
{
|
{
|
||||||
// Create and show a window to trigger shell integration initialzation,
|
// Create and show a window to trigger shell integration initialzation,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user