Client: Test for xdg surface window geometry
Change-Id: I2f336a81682317b1f7dc939d911906b4db60a386 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
This commit is contained in:
parent
a9c9f52620
commit
6c71a283d8
@ -86,6 +86,8 @@ XdgSurface::XdgSurface(XdgWmBase *xdgWmBase, Surface *surface, wl_client *client
|
|||||||
connect(this, &XdgSurface::toplevelCreated, xdgWmBase, &XdgWmBase::toplevelCreated);
|
connect(this, &XdgSurface::toplevelCreated, xdgWmBase, &XdgWmBase::toplevelCreated);
|
||||||
connect(surface, &Surface::attach, this, &XdgSurface::verifyConfigured);
|
connect(surface, &Surface::attach, this, &XdgSurface::verifyConfigured);
|
||||||
connect(surface, &Surface::commit, this, [this] {
|
connect(surface, &Surface::commit, this, [this] {
|
||||||
|
m_committed = m_pending;
|
||||||
|
|
||||||
if (m_ackedConfigureSerial != m_committedConfigureSerial) {
|
if (m_ackedConfigureSerial != m_committedConfigureSerial) {
|
||||||
m_committedConfigureSerial = m_ackedConfigureSerial;
|
m_committedConfigureSerial = m_ackedConfigureSerial;
|
||||||
emit configureCommitted(m_committedConfigureSerial);
|
emit configureCommitted(m_committedConfigureSerial);
|
||||||
@ -133,6 +135,14 @@ void XdgSurface::xdg_surface_destroy_resource(Resource *resource)
|
|||||||
delete this;
|
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)
|
void XdgSurface::xdg_surface_ack_configure(Resource *resource, uint32_t serial)
|
||||||
{
|
{
|
||||||
Q_UNUSED(resource);
|
Q_UNUSED(resource);
|
||||||
|
@ -83,6 +83,9 @@ public:
|
|||||||
QVector<uint> m_pendingConfigureSerials;
|
QVector<uint> m_pendingConfigureSerials;
|
||||||
uint m_ackedConfigureSerial = 0;
|
uint m_ackedConfigureSerial = 0;
|
||||||
uint m_committedConfigureSerial = 0;
|
uint m_committedConfigureSerial = 0;
|
||||||
|
struct DoubleBufferedState {
|
||||||
|
QRect windowGeometry = {0, 0, 0, 0};
|
||||||
|
} m_pending, m_committed;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void verifyConfigured() { QVERIFY(m_configureSent); }
|
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_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 *resource) override;
|
||||||
void xdg_surface_destroy(Resource *resource) override { wl_resource_destroy(resource->handle); }
|
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;
|
void xdg_surface_ack_configure(Resource *resource, uint32_t serial) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ private slots:
|
|||||||
void popup();
|
void popup();
|
||||||
void pongs();
|
void pongs();
|
||||||
void minMaxSize();
|
void minMaxSize();
|
||||||
|
void windowGeometry();
|
||||||
};
|
};
|
||||||
|
|
||||||
void tst_xdgshell::showMinimized()
|
void tst_xdgshell::showMinimized()
|
||||||
@ -287,5 +288,20 @@ void tst_xdgshell::minMaxSize()
|
|||||||
QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.minSize, QSize(50, 40));
|
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)
|
QCOMPOSITOR_TEST_MAIN(tst_xdgshell)
|
||||||
#include "tst_xdgshell.moc"
|
#include "tst_xdgshell.moc"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user