Add basic client test for subsurfaces
Change-Id: I1ef21287933a2afccad989f47e4fe59329b6f537 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
parent
5e5235e0e6
commit
027f48b7d9
@ -163,6 +163,16 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
class Subsurface : public QObject, public QtWaylandServer::wl_subsurface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Subsurface(wl_client *client, int id, int version)
|
||||
: QtWaylandServer::wl_subsurface(client, id, version)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class SubCompositor : public Global, public QtWaylandServer::wl_subcompositor
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -170,7 +180,20 @@ public:
|
||||
explicit SubCompositor(CoreCompositor *compositor, int version = 1)
|
||||
: QtWaylandServer::wl_subcompositor(compositor->m_display, version)
|
||||
{}
|
||||
// TODO
|
||||
QVector<Subsurface *> m_subsurfaces;
|
||||
|
||||
signals:
|
||||
void subsurfaceCreated(Subsurface *subsurface);
|
||||
|
||||
protected:
|
||||
void subcompositor_get_subsurface(Resource *resource, uint32_t id, ::wl_resource *surface, ::wl_resource *parent) override
|
||||
{
|
||||
QTRY_VERIFY(parent);
|
||||
QTRY_VERIFY(surface);
|
||||
auto *subsurface = new Subsurface(resource->client(), id, resource->version());
|
||||
m_subsurfaces.append(subsurface); // TODO: clean up?
|
||||
emit subsurfaceCreated(subsurface);
|
||||
}
|
||||
};
|
||||
|
||||
struct OutputMode {
|
||||
|
@ -50,6 +50,7 @@ public:
|
||||
// Convenience functions
|
||||
Output *output(int i = 0) { return getAll<Output>().value(i, nullptr); }
|
||||
Surface *surface(int i = 0) { return get<WlCompositor>()->m_surfaces.value(i, nullptr); }
|
||||
Subsurface *subSurface(int i = 0) { return get<SubCompositor>()->m_subsurfaces.value(i, nullptr); }
|
||||
XdgSurface *xdgSurface(int i = 0) { return get<XdgWmBase>()->m_xdgSurfaces.value(i, nullptr); }
|
||||
XdgToplevel *xdgToplevel(int i = 0) { return get<XdgWmBase>()->toplevel(i); }
|
||||
XdgPopup *xdgPopup(int i = 0) { return get<XdgWmBase>()->popup(i); }
|
||||
|
@ -41,6 +41,8 @@ private slots:
|
||||
void waitForFrameCallbackRaster();
|
||||
void waitForFrameCallbackGl();
|
||||
void negotiateShmFormat();
|
||||
|
||||
void createSubsurface();
|
||||
};
|
||||
|
||||
void tst_surface::createDestroySurface()
|
||||
@ -154,5 +156,21 @@ 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);
|
||||
|
||||
QRasterWindow subWindow;
|
||||
subWindow.setParent(&window);
|
||||
subWindow.resize(64, 64);
|
||||
subWindow.show();
|
||||
QCOMPOSITOR_TRY_VERIFY(subSurface());
|
||||
}
|
||||
|
||||
QCOMPOSITOR_TEST_MAIN(tst_surface)
|
||||
#include "tst_surface.moc"
|
||||
|
Loading…
x
Reference in New Issue
Block a user