summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDavid Edmundson <davidedmundson@kde.org>2020-09-14 17:08:39 +0100
committerDavid Edmundson <davidedmundson@kde.org>2021-03-01 10:07:56 +0000
commitb36a345d727eab37ee4ec4c2dc4674d5971c81d8 (patch)
treed01deae15799378ab05328353ec8a2743e805dd5 /tests
parent95d2b2c40ede91c250247947240b024a93a98431 (diff)
downloadqtwayland-b36a345d727eab37ee4ec4c2dc4674d5971c81d8.tar.gz
Client: Send exposeEvent to parent on subsurface position changes
When a subsurface is moved, we need the parent window to commit to apply that move. Ideally we want this in sync with any potential rendering on the parent window. Currently the code calls requestUpdate() which acts more like a frame callback; it will only do something if the main QWindow considers itself dirty. We want to force a repaint, which is semantically more similar to an ExposeEvent. Fixes: QTBUG-86177 Pick-to: 5.15 Change-Id: I30bdfa357beee860ce2b00a256eaea6d040dd55c Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/client/surface/tst_surface.cpp33
1 files changed, 28 insertions, 5 deletions
diff --git a/tests/auto/client/surface/tst_surface.cpp b/tests/auto/client/surface/tst_surface.cpp
index c7b02e2c..60d89132 100644
--- a/tests/auto/client/surface/tst_surface.cpp
+++ b/tests/auto/client/surface/tst_surface.cpp
@@ -165,17 +165,40 @@ void tst_surface::negotiateShmFormat()
void tst_surface::createSubsurface()
{
QRasterWindow window;
- window.resize(64, 64);
- window.show();
- QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
- exec([=] { xdgToplevel()->sendCompleteConfigure(); });
- QCOMPOSITOR_TRY_VERIFY(xdgSurface()->m_committedConfigureSerial);
+ window.setObjectName("main");
+ window.resize(200, 200);
QRasterWindow subWindow;
+ subWindow.setObjectName("subwindow");
subWindow.setParent(&window);
subWindow.resize(64, 64);
+
+ window.show();
subWindow.show();
+
QCOMPOSITOR_TRY_VERIFY(subSurface());
+ QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
+ exec([=] { xdgToplevel()->sendCompleteConfigure(); });
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface()->m_committedConfigureSerial);
+
+ const Surface *mainSurface = exec([=] {return surface(0);});
+ const Surface *childSurface = exec([=] {return surface(1);});
+ QSignalSpy mainSurfaceCommitSpy(mainSurface, &Surface::commit);
+ QSignalSpy childSurfaceCommitSpy(childSurface, &Surface::commit);
+
+ // Move subsurface. The parent should redraw and commit
+ subWindow.setGeometry(100, 100, 64, 64);
+ // the toplevel should commit to indicate the subsurface moved
+ QCOMPOSITOR_TRY_COMPARE(mainSurfaceCommitSpy.count(), 1);
+ mainSurfaceCommitSpy.clear();
+ childSurfaceCommitSpy.clear();
+
+ // Move and resize the subSurface. The parent should redraw and commit
+ // The child should also redraw
+ subWindow.setGeometry(50, 50, 80, 80);
+ QCOMPOSITOR_TRY_COMPARE(mainSurfaceCommitSpy.count(), 1);
+ QCOMPOSITOR_TRY_COMPARE(childSurfaceCommitSpy.count(), 1);
+
}
// Used to cause a crash in libwayland (QTBUG-79674)