on xenial help sign in
update mocks/tests
commit868bceed0377db102acf941c948ae620e298b076 authorMichael Zanetti <michael.zanetti@canonical.com> dateMon 15 Feb 2016, 20:47 (11 years ago) parent8f4dbe0
4 files changed+12−13
tests/mocks/Unity/Application/SurfaceManager.cpp+7−9 tests/mocks/Unity/Application/SurfaceManager.h+3−2 tests/qmltests/tst_OrientedShell.qml+1−1 tests/qmltests/tst_Shell.qml+1−1
tests/mocks/Unity/Application/SurfaceManager.cpp+7−9
@@ -34,6 +34,12 @@ SurfaceManager::SurfaceManager(QObject *parent) :
3434 QObject(parent)
3535 , m_virtualKeyboard(nullptr)
3636{
37+ m_virtualKeyboard = new VirtualKeyboard;
38+ connect(m_virtualKeyboard, &QObject::destroyed, this, [this](QObject *obj) {
39+ MirSurface* surface = qobject_cast<MirSurface*>(obj);
40+ Q_EMIT inputMethodSurfaceChanged();
41+ Q_EMIT surfaceDestroyed(surface);
42+ });
3743}
3844
3945MirSurface *SurfaceManager::createSurface(const QString& name,
@@ -50,15 +56,7 @@ MirSurface *SurfaceManager::createSurface(const QString& name,
5056 return surface;
5157}
5258
53−MirSurface *SurfaceManager::inputMethodSurface()
59+MirSurface *SurfaceManager::inputMethodSurface() const
5460{
55− if (!m_virtualKeyboard) {
56− m_virtualKeyboard = new VirtualKeyboard;
57− connect(m_virtualKeyboard, &QObject::destroyed, this, [this](QObject *obj) {
58− MirSurface* surface = qobject_cast<MirSurface*>(obj);
59− Q_EMIT surfaceDestroyed(surface);
60− });
61− Q_EMIT surfaceCreated(m_virtualKeyboard);
62− }
6361 return m_virtualKeyboard;
6462}
tests/mocks/Unity/Application/SurfaceManager.h+3−2
@@ -25,6 +25,7 @@
2525class SurfaceManager : public QObject
2626{
2727 Q_OBJECT
28+ Q_PROPERTY(MirSurfaceInterface* inputMethodSurface READ inputMethodSurface NOTIFY inputMethodSurfaceChanged)
2829public:
2930 explicit SurfaceManager(QObject *parent = 0);
3031
@@ -35,10 +36,10 @@ public:
3536 Mir::State state,
3637 const QUrl& screenshot);
3738
38− // To be used in the tests
39− Q_INVOKABLE MirSurface* inputMethodSurface();
39+ MirSurface* inputMethodSurface() const;
4040
4141Q_SIGNALS:
42+ void inputMethodSurfaceChanged();
4243 void countChanged();
4344 void surfaceCreated(MirSurface *surface);
4445 void surfaceDestroyed(MirSurface*surface);
tests/qmltests/tst_OrientedShell.qml+1−1
@@ -314,7 +314,7 @@ Rectangle {
314314 checked: false
315315 activeFocusOnPress: false
316316 onCheckedChanged: {
317− var surface = SurfaceManager.inputMethodSurface();
317+ var surface = SurfaceManager.inputMethodSurface;
318318 if (checked) {
319319 surface.setState(Mir.RestoredState);
320320 } else {
tests/qmltests/tst_Shell.qml+1−1
@@ -762,7 +762,7 @@ Rectangle {
762762 loadShell("phone");
763763 swipeAwayGreeter();
764764 var item = findChild(shell, "inputMethod");
765− var surface = SurfaceManager.inputMethodSurface();
765+ var surface = SurfaceManager.inputMethodSurface;
766766
767767 surface.setState(Mir.MinimizedState);
768768 tryCompare(item, "visible", false);