on xenial help sign in
[tests] add orientation property to mock MirSurfaceItem
c915fa0Gerry Boland
tests/mocks/Unity/Application/MirSurfaceItem.cpp+10
@@ -38,6 +38,7 @@ MirSurfaceItem::MirSurfaceItem(const QString& name,
38 , m_name(name)
38 , m_name(name)
39 , m_type(type)
39 , m_type(type)
40 , m_state(state)
40 , m_state(state)
41+ , m_orientation(Qt::PortraitOrientation)
41 , m_parentSurface(nullptr)
42 , m_parentSurface(nullptr)
42 , m_qmlItem(nullptr)
43 , m_qmlItem(nullptr)
43 , m_screenshotUrl(screenshot)
44 , m_screenshotUrl(screenshot)
@@ -121,6 +122,15 @@ void MirSurfaceItem::release()
121 }
122 }
122}
123}
123
124
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+
124void MirSurfaceItem::setApplication(ApplicationInfo* application)
134void MirSurfaceItem::setApplication(ApplicationInfo* application)
125{
135{
126 m_application = application;
136 m_application = application;
tests/mocks/Unity/Application/MirSurfaceItem.h+5
@@ -32,6 +32,7 @@ class MirSurfaceItem : public QQuickItem
32 Q_PROPERTY(Type type READ type NOTIFY typeChanged)
32 Q_PROPERTY(Type type READ type NOTIFY typeChanged)
33 Q_PROPERTY(State state READ state NOTIFY stateChanged)
33 Q_PROPERTY(State state READ state NOTIFY stateChanged)
34 Q_PROPERTY(QString name READ name NOTIFY nameChanged)
34 Q_PROPERTY(QString name READ name NOTIFY nameChanged)
35+ Q_PROPERTY(Qt::ScreenOrientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged DESIGNABLE false)
35 Q_PROPERTY(MirSurfaceItem* parentSurface READ parentSurface NOTIFY parentSurfaceChanged)
36 Q_PROPERTY(MirSurfaceItem* parentSurface READ parentSurface NOTIFY parentSurfaceChanged)
36 Q_PROPERTY(QQmlListProperty<MirSurfaceItem> childSurfaces READ childSurfaces NOTIFY childSurfacesChanged DESIGNABLE false)
37 Q_PROPERTY(QQmlListProperty<MirSurfaceItem> childSurfaces READ childSurfaces NOTIFY childSurfacesChanged DESIGNABLE false)
37
38
@@ -69,9 +70,11 @@ public:
69 Type type() const { return m_type; }
70 Type type() const { return m_type; }
70 State state() const { return m_state; }
71 State state() const { return m_state; }
71 QString name() const { return m_name; }
72 QString name() const { return m_name; }
73+ Qt::ScreenOrientation orientation() const { return m_orientation; }
72 MirSurfaceItem* parentSurface() const { return m_parentSurface; }
74 MirSurfaceItem* parentSurface() const { return m_parentSurface; }
73 QList<MirSurfaceItem*> childSurfaceList();
75 QList<MirSurfaceItem*> childSurfaceList();
74
76
77+ void setOrientation(const Qt::ScreenOrientation orientation);
75 void setApplication(ApplicationInfo* item);
78 void setApplication(ApplicationInfo* item);
76 void setParentSurface(MirSurfaceItem* item);
79 void setParentSurface(MirSurfaceItem* item);
77
80
@@ -82,6 +85,7 @@ Q_SIGNALS:
82 void typeChanged(Type);
85 void typeChanged(Type);
83 void stateChanged(State);
86 void stateChanged(State);
84 void nameChanged(QString);
87 void nameChanged(QString);
88+ void orientationChanged();
85 void parentSurfaceChanged(MirSurfaceItem*);
89 void parentSurfaceChanged(MirSurfaceItem*);
86 void childSurfacesChanged();
90 void childSurfacesChanged();
87
91
@@ -110,6 +114,7 @@ private:
110 const QString m_name;
114 const QString m_name;
111 const Type m_type;
115 const Type m_type;
112 State m_state;
116 State m_state;
117+ Qt::ScreenOrientation m_orientation;
113
118
114 MirSurfaceItem* m_parentSurface;
119 MirSurfaceItem* m_parentSurface;
115 QList<MirSurfaceItem*> m_children;
120 QList<MirSurfaceItem*> m_children;