on xenial help sign in
[tests] add orientation property to mock MirSurfaceItem
commitc915fa06da0b571d74b628d6dcf67eee2f1bcbb4 authorGerry Boland <gerry.boland@canonical.com> dateWed 3 Sep 2014, 11:38 (12 years ago) parent1ae16e2
2 files changed+15
tests/mocks/Unity/Application/MirSurfaceItem.cpp+10 tests/mocks/Unity/Application/MirSurfaceItem.h+5
tests/mocks/Unity/Application/MirSurfaceItem.cpp+10
@@ -38,6 +38,7 @@ MirSurfaceItem::MirSurfaceItem(const QString& name,
3838 , m_name(name)
3939 , m_type(type)
4040 , m_state(state)
41+ , m_orientation(Qt::PortraitOrientation)
4142 , m_parentSurface(nullptr)
4243 , m_qmlItem(nullptr)
4344 , m_screenshotUrl(screenshot)
@@ -121,6 +122,15 @@ void MirSurfaceItem::release()
121122 }
122123}
123124
125+void MirSurfaceItem::setOrientation(const Qt::ScreenOrientation orientation)
126+{
127+ if (m_orientation == orientation)
128+ return;
129+
130+ m_orientation = orientation;
131+ Q_EMIT orientationChanged();
132+}
133+
124134void MirSurfaceItem::setApplication(ApplicationInfo* application)
125135{
126136 m_application = application;
tests/mocks/Unity/Application/MirSurfaceItem.h+5
@@ -32,6 +32,7 @@ class MirSurfaceItem : public QQuickItem
3232 Q_PROPERTY(Type type READ type NOTIFY typeChanged)
3333 Q_PROPERTY(State state READ state NOTIFY stateChanged)
3434 Q_PROPERTY(QString name READ name NOTIFY nameChanged)
35+ Q_PROPERTY(Qt::ScreenOrientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged DESIGNABLE false)
3536 Q_PROPERTY(MirSurfaceItem* parentSurface READ parentSurface NOTIFY parentSurfaceChanged)
3637 Q_PROPERTY(QQmlListProperty<MirSurfaceItem> childSurfaces READ childSurfaces NOTIFY childSurfacesChanged DESIGNABLE false)
3738
@@ -69,9 +70,11 @@ public:
6970 Type type() const { return m_type; }
7071 State state() const { return m_state; }
7172 QString name() const { return m_name; }
73+ Qt::ScreenOrientation orientation() const { return m_orientation; }
7274 MirSurfaceItem* parentSurface() const { return m_parentSurface; }
7375 QList<MirSurfaceItem*> childSurfaceList();
7476
77+ void setOrientation(const Qt::ScreenOrientation orientation);
7578 void setApplication(ApplicationInfo* item);
7679 void setParentSurface(MirSurfaceItem* item);
7780
@@ -82,6 +85,7 @@ Q_SIGNALS:
8285 void typeChanged(Type);
8386 void stateChanged(State);
8487 void nameChanged(QString);
88+ void orientationChanged();
8589 void parentSurfaceChanged(MirSurfaceItem*);
8690 void childSurfacesChanged();
8791
@@ -110,6 +114,7 @@ private:
110114 const QString m_name;
111115 const Type m_type;
112116 State m_state;
117+ Qt::ScreenOrientation m_orientation;
113118
114119 MirSurfaceItem* m_parentSurface;
115120 QList<MirSurfaceItem*> m_children;