1
/* * This file is part of Maliit framework *
3
* Copyright (C) 2012 Openismus GmbH
5
* Contact: maliit-discuss@lists.maliit.org
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public
9
* License version 2.1 as published by the Free Software Foundation
10
* and appearing in the file LICENSE.LGPL included in the packaging
14
#include "testsurfacefactory.h"
15
#include "windowedsurface.h"
20
//! \ingroup pluginapi
21
//! \brief Allows to create a surface without a running maliit-server instance. Useful for tests.
23
//! \note Plugins must not use this, but should instead use the Maliit::Plugins::AbstractSurfaceFactory
24
//! returned by MAbstractInputMethodHost::surfaceFactory().
26
//! \param options the options the surface should have
27
//! \param parent the parent of the new surface
28
//! \returns a new shared Maliit::Plugins::AbstractSurface
29
QSharedPointer<AbstractSurface> createTestSurface(AbstractSurface::Options options,
30
const QSharedPointer<AbstractSurface> &parent)
32
static Maliit::Server::WindowedSurfaceFactory factory;
34
return factory.create(options, parent);
37
//! \ingroup pluginapi
38
//! \brief Allows to create a graphics view surface without a running maliit-server instance. Useful for tests.
40
//! \note Plugins must not use this, but should instead use the Maliit::Plugins::AbstractSurfaceFactory
41
//! returned by MAbstractInputMethodHost::surfaceFactory().
43
//! \param parent the parent of the new surface
44
//! \returns a new shared Maliit::Plugins::AbstractGraphicsViewSurface
45
QSharedPointer<AbstractGraphicsViewSurface> createTestGraphicsViewSurface(const QSharedPointer<AbstractSurface> &parent)
47
QSharedPointer<AbstractSurface> surface;
50
surface = createTestSurface(AbstractSurface::PositionOverlay | AbstractSurface::TypeGraphicsView, parent);
52
surface = createTestSurface(AbstractSurface::PositionCenterBottom | AbstractSurface::TypeGraphicsView, parent);
55
return qSharedPointerDynamicCast<AbstractGraphicsViewSurface>(surface);
58
//! \ingroup pluginapi
59
//! \brief Allows to create a widget surface without a running maliit-server instance. Useful for tests.
61
//! \note Plugins must not use this, but should instead use the Maliit::Plugins::AbstractSurfaceFactory
62
//! returned by MAbstractInputMethodHost::surfaceFactory().
64
//! \param parent the parent of the new surface
65
//! \returns a new shared Maliit::Plugins::AbstractWidgetSurface
66
QSharedPointer<AbstractWidgetSurface> createTestWidgetSurface(const QSharedPointer<AbstractSurface> &parent)
68
QSharedPointer<AbstractSurface> surface;
71
surface = createTestSurface(AbstractSurface::PositionOverlay | AbstractSurface::TypeWidget, parent);
73
surface = createTestSurface(AbstractSurface::PositionCenterBottom | AbstractSurface::TypeWidget, parent);
76
return qSharedPointerDynamicCast<AbstractWidgetSurface>(surface);
79
} // namespace Plugins