summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPier Luigi Fiorini <pierluigi.fiorini@liri.io>2019-01-13 23:28:06 +0100
committerPier Luigi Fiorini <pierluigi.fiorini@liri.io>2019-01-15 10:50:23 +0000
commiteef9f34e58465458420f6e1295bdce4a59702c54 (patch)
tree5b587640f888da816c43f5ec96bdc301f1ed261b /tests
parentfb764cd406dd64dcb4caf0df2dca8b621d80f58b (diff)
Client: Test for xdg surface window geometry
Change-Id: I2f336a81682317b1f7dc939d911906b4db60a386 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/client/shared/xdgshell.cpp10
-rw-r--r--tests/auto/client/shared/xdgshell.h4
-rw-r--r--tests/auto/client/xdgshell/tst_xdgshell.cpp16
3 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/client/shared/xdgshell.cpp b/tests/auto/client/shared/xdgshell.cpp
index 4cabd3d87..6bc303020 100644
--- a/tests/auto/client/shared/xdgshell.cpp
+++ b/tests/auto/client/shared/xdgshell.cpp
@@ -86,6 +86,8 @@ XdgSurface::XdgSurface(XdgWmBase *xdgWmBase, Surface *surface, wl_client *client
connect(this, &XdgSurface::toplevelCreated, xdgWmBase, &XdgWmBase::toplevelCreated);
connect(surface, &Surface::attach, this, &XdgSurface::verifyConfigured);
connect(surface, &Surface::commit, this, [this] {
+ m_committed = m_pending;
+
if (m_ackedConfigureSerial != m_committedConfigureSerial) {
m_committedConfigureSerial = m_ackedConfigureSerial;
emit configureCommitted(m_committedConfigureSerial);
@@ -133,6 +135,14 @@ void XdgSurface::xdg_surface_destroy_resource(Resource *resource)
delete this;
}
+void XdgSurface::xdg_surface_set_window_geometry(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height)
+{
+ Q_UNUSED(resource);
+ QRect rect(x, y, width, height);
+ QVERIFY(rect.isValid());
+ m_pending.windowGeometry = rect;
+}
+
void XdgSurface::xdg_surface_ack_configure(Resource *resource, uint32_t serial)
{
Q_UNUSED(resource);
diff --git a/tests/auto/client/shared/xdgshell.h b/tests/auto/client/shared/xdgshell.h
index 037de20d1..1a01ea1ea 100644
--- a/tests/auto/client/shared/xdgshell.h
+++ b/tests/auto/client/shared/xdgshell.h
@@ -83,6 +83,9 @@ public:
QVector<uint> m_pendingConfigureSerials;
uint m_ackedConfigureSerial = 0;
uint m_committedConfigureSerial = 0;
+ struct DoubleBufferedState {
+ QRect windowGeometry = {0, 0, 0, 0};
+ } m_pending, m_committed;
public slots:
void verifyConfigured() { QVERIFY(m_configureSent); }
@@ -96,6 +99,7 @@ protected:
void xdg_surface_get_popup(Resource *resource, uint32_t id, ::wl_resource *parent, ::wl_resource *positioner) override;
void xdg_surface_destroy_resource(Resource *resource) override;
void xdg_surface_destroy(Resource *resource) override { wl_resource_destroy(resource->handle); }
+ void xdg_surface_set_window_geometry(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override;
void xdg_surface_ack_configure(Resource *resource, uint32_t serial) override;
};
diff --git a/tests/auto/client/xdgshell/tst_xdgshell.cpp b/tests/auto/client/xdgshell/tst_xdgshell.cpp
index 1bfabe55f..de0341014 100644
--- a/tests/auto/client/xdgshell/tst_xdgshell.cpp
+++ b/tests/auto/client/xdgshell/tst_xdgshell.cpp
@@ -44,6 +44,7 @@ private slots:
void popup();
void pongs();
void minMaxSize();
+ void windowGeometry();
};
void tst_xdgshell::showMinimized()
@@ -287,5 +288,20 @@ void tst_xdgshell::minMaxSize()
QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.minSize, QSize(50, 40));
}
+void tst_xdgshell::windowGeometry()
+{
+ QRasterWindow window;
+ window.resize(400, 320);
+ window.show();
+ QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
+
+ exec([=] { xdgToplevel()->sendCompleteConfigure(); });
+
+ QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committed.windowGeometry, QRect(QPoint(0, 0), window.frameGeometry().size()));
+
+ window.resize(800, 600);
+ QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committed.windowGeometry, QRect(QPoint(0, 0), window.frameGeometry().size()));
+}
+
QCOMPOSITOR_TEST_MAIN(tst_xdgshell)
#include "tst_xdgshell.moc"