summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-12-05 12:51:22 +0100
committerJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-12-06 12:53:12 +0100
commit1d0863049111926e0ff827cf17f3a7087d53c5c3 (patch)
tree2d2bd09100e1b78071448b5260c345b11c15ea6f /tests
parent7c0833f4bc22d2d947c793f0711e3f1e1a09012c (diff)
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>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/client/xdgshell/tst_xdgshell.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/auto/client/xdgshell/tst_xdgshell.cpp b/tests/auto/client/xdgshell/tst_xdgshell.cpp
index d1c2882a0..2277bbb80 100644
--- a/tests/auto/client/xdgshell/tst_xdgshell.cpp
+++ b/tests/auto/client/xdgshell/tst_xdgshell.cpp
@@ -46,6 +46,7 @@ private slots:
void popup();
void tooltipOnPopup();
void switchPopups();
+ void hidePopupParent();
void pongs();
void minMaxSize();
void windowGeometry();
@@ -429,6 +430,50 @@ void tst_xdgshell::switchPopups()
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()
{
// Create and show a window to trigger shell integration initialzation,