summaryrefslogtreecommitdiffstats
path: root/tests/auto/client/xdgshellv6/tst_xdgshellv6.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/client/xdgshellv6/tst_xdgshellv6.cpp')
-rw-r--r--tests/auto/client/xdgshellv6/tst_xdgshellv6.cpp58
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/auto/client/xdgshellv6/tst_xdgshellv6.cpp b/tests/auto/client/xdgshellv6/tst_xdgshellv6.cpp
index 91679cb57..3c822325b 100644
--- a/tests/auto/client/xdgshellv6/tst_xdgshellv6.cpp
+++ b/tests/auto/client/xdgshellv6/tst_xdgshellv6.cpp
@@ -58,6 +58,14 @@ public:
return QWindow::event(event);
}
+ void exposeEvent(QExposeEvent *event) override
+ {
+ ++exposeEventCount;
+ QWindow::exposeEvent(event);
+ }
+
+ int exposeEventCount = 0;
+
signals:
void windowStateChangeEventReceived(uint oldState);
};
@@ -101,6 +109,8 @@ private slots:
void windowStateChangedEvents();
void windowGeometrySimple();
void windowGeometryFixed();
+ void flushUnconfiguredXdgSurface();
+ void dontSpamExposeEvents();
private:
MockCompositor *m_compositor = nullptr;
@@ -360,6 +370,54 @@ void tst_WaylandClientXdgShellV6::windowGeometryFixed()
QCOMPARE(geometrySpy.takeFirst().at(0).toRect().size(), initialWindowGeometry.size());
}
+void tst_WaylandClientXdgShellV6::flushUnconfiguredXdgSurface()
+{
+ TestWindow window;
+ window.show();
+
+ QSharedPointer<MockSurface> surface;
+ QTRY_VERIFY(surface = m_compositor->surface());
+
+ // Paint and flush some magenta
+ QBackingStore backingStore(&window);
+ QRect rect(QPoint(), window.size());
+ backingStore.resize(rect.size());
+ backingStore.beginPaint(rect);
+ QColor color = Qt::magenta;
+ QPainter p(backingStore.paintDevice());
+ p.fillRect(rect, color);
+ p.end();
+ backingStore.endPaint();
+ backingStore.flush(rect);
+
+ // We're not allowed to send buffer on this surface since it isn't yet configured.
+ // So, from the compositor's point of view there should be no buffer data yet.
+ m_compositor->processWaylandEvents();
+ QVERIFY(surface->image.isNull());
+ QVERIFY(!window.isExposed());
+
+ // Finally sending the configure should trigger an attach and commit with the
+ // right buffer.
+ m_compositor->sendShellSurfaceConfigure(surface);
+ QTRY_COMPARE(surface->image.size(), window.frameGeometry().size());
+ QTRY_COMPARE(surface->image.pixel(window.frameMargins().left(), window.frameMargins().top()), color.rgba());
+ QVERIFY(window.isExposed());
+}
+
+void tst_WaylandClientXdgShellV6::dontSpamExposeEvents()
+{
+ TestWindow window;
+ window.show();
+
+ QSharedPointer<MockSurface> surface;
+ QTRY_VERIFY(surface = m_compositor->surface());
+ QTRY_VERIFY(window.exposeEventCount == 0);
+
+ m_compositor->sendShellSurfaceConfigure(surface);
+ QTRY_VERIFY(window.isExposed());
+ QTRY_VERIFY(window.exposeEventCount == 1);
+}
+
int main(int argc, char **argv)
{
setenv("XDG_RUNTIME_DIR", ".", 1);