summaryrefslogtreecommitdiffstats
path: root/tests/auto/client/shared/mockcompositor.cpp
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2018-03-08 12:32:59 +0100
committerJohan Helsing <johan.helsing@qt.io>2018-03-12 11:05:55 +0000
commit70344cd68de5f6d73bfe17d060d1ad7abcb98704 (patch)
treec6f9c8e4090af31a9fd235e03864a8e8d0835779 /tests/auto/client/shared/mockcompositor.cpp
parent7ce033cbf9a80d2ea5d687956da668cf4567d361 (diff)
Add client-side tests for ivi-application
Tests ivi surface creation and configuration. Task-number: QTBUG-66512 Change-Id: Idff60eb99eb34b7fce1c935bd036ef18a8f97d7c Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'tests/auto/client/shared/mockcompositor.cpp')
-rw-r--r--tests/auto/client/shared/mockcompositor.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/auto/client/shared/mockcompositor.cpp b/tests/auto/client/shared/mockcompositor.cpp
index 51a954617..9ef08ad95 100644
--- a/tests/auto/client/shared/mockcompositor.cpp
+++ b/tests/auto/client/shared/mockcompositor.cpp
@@ -32,6 +32,7 @@
#include "mocksurface.h"
#include "mockwlshell.h"
#include "mockxdgshellv6.h"
+#include "mockiviapplication.h"
#include <wayland-xdg-shell-unstable-v6-server-protocol.h>
@@ -227,6 +228,14 @@ void MockCompositor::sendShellSurfaceConfigure(const QSharedPointer<MockSurface>
processCommand(command);
}
+void MockCompositor::sendIviSurfaceConfigure(const QSharedPointer<MockIviSurface> iviSurface, const QSize &size)
+{
+ Command command = makeCommand(Impl::Compositor::sendIviSurfaceConfigure, m_compositor);
+ command.parameters << QVariant::fromValue(iviSurface);
+ command.parameters << QVariant::fromValue(size);
+ processCommand(command);
+}
+
void MockCompositor::sendXdgToplevelV6Configure(const QSharedPointer<MockXdgToplevelV6> toplevel, const QSize &size)
{
Command command = makeCommand(Impl::Compositor::sendXdgToplevelV6Configure, m_compositor);
@@ -267,6 +276,16 @@ QSharedPointer<MockOutput> MockCompositor::output(int index)
return result;
}
+QSharedPointer<MockIviSurface> MockCompositor::iviSurface(int index)
+{
+ QSharedPointer<MockIviSurface> result;
+ lock();
+ if (Impl::IviSurface *toplevel = m_compositor->iviApplication()->iviSurfaces().value(index, nullptr))
+ result = toplevel->mockIviSurface();
+ unlock();
+ return result;
+}
+
QSharedPointer<MockXdgToplevelV6> MockCompositor::xdgToplevelV6(int index)
{
QSharedPointer<MockXdgToplevelV6> result;
@@ -357,6 +376,7 @@ Compositor::Compositor()
m_touch = m_seat->touch();
m_outputs.append(new Output(m_display, QSize(1920, 1080), QPoint(0, 0)));
+ m_iviApplication.reset(new IviApplication(m_display));
m_wlShell.reset(new WlShell(m_display));
m_xdgShellV6.reset(new XdgShellV6(m_display));
@@ -426,6 +446,11 @@ QVector<Output *> Compositor::outputs() const
return m_outputs;
}
+IviApplication *Compositor::iviApplication() const
+{
+ return m_iviApplication.data();
+}
+
XdgShellV6 *Compositor::xdgShellV6() const
{
return m_xdgShellV6.data();
@@ -460,6 +485,12 @@ Output *Compositor::resolveOutput(const QVariant &v)
return mockOutput ? mockOutput->handle() : nullptr;
}
+IviSurface *Compositor::resolveIviSurface(const QVariant &v)
+{
+ QSharedPointer<MockIviSurface> mockIviSurface = v.value<QSharedPointer<MockIviSurface>>();
+ return mockIviSurface ? mockIviSurface->handle() : nullptr;
+}
+
XdgToplevelV6 *Compositor::resolveToplevel(const QVariant &v)
{
QSharedPointer<MockXdgToplevelV6> mockToplevel = v.value<QSharedPointer<MockXdgToplevelV6>>();