Register a fake appmenu UI for the appmenu test

This commit is contained in:
David Edmundson 2017-12-22 17:23:44 +00:00
parent 2f9d0bd626
commit 965c30f4d4

View file

@ -26,6 +26,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "wayland_server.h" #include "wayland_server.h"
#include "workspace.h" #include "workspace.h"
#include <QDBusConnection>
#include <KWayland/Client/connection_thread.h> #include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/compositor.h> #include <KWayland/Client/compositor.h>
#include <KWayland/Client/shell.h> #include <KWayland/Client/shell.h>
@ -961,6 +963,9 @@ void TestShellClient::testX11WindowId()
void TestShellClient::testAppMenu() void TestShellClient::testAppMenu()
{ {
//register a faux appmenu client
QVERIFY (QDBusConnection::sessionBus().registerService("org.kde.kappmenu"));
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QScopedPointer<QObject> shellSurface(Test::createShellSurface(Test::ShellSurfaceType::XdgShellV6, surface.data())); QScopedPointer<QObject> shellSurface(Test::createShellSurface(Test::ShellSurfaceType::XdgShellV6, surface.data()));
auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
@ -972,6 +977,8 @@ void TestShellClient::testAppMenu()
QCOMPARE(c->hasApplicationMenu(), true); QCOMPARE(c->hasApplicationMenu(), true);
QCOMPARE(c->applicationMenuServiceName(), QString("service.name")); QCOMPARE(c->applicationMenuServiceName(), QString("service.name"));
QCOMPARE(c->applicationMenuObjectPath(), QString("object/path")); QCOMPARE(c->applicationMenuObjectPath(), QString("object/path"));
QVERIFY (QDBusConnection::sessionBus().unregisterService("org.kde.kappmenu"));
} }