2 * Copyright (C) 2015-2016 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17#ifndef MOCK_MIR_SURFACE_H
18#define MOCK_MIR_SURFACE_H
26#include <unity/shell/application/MirSurfaceInterface.h>
28#include "MirSurfaceListModel.h"
32class MirSurface : public unity::shell::application::MirSurfaceInterface
37 // for use in qml tests
38 Q_PROPERTY(int width READ width NOTIFY widthChanged)
39 Q_PROPERTY(int height READ height NOTIFY heightChanged)
40 Q_PROPERTY(bool activeFocus READ activeFocus NOTIFY activeFocusChanged)
41 Q_PROPERTY(bool slowToResize READ isSlowToResize WRITE setSlowToResize NOTIFY slowToResizeChanged)
42 Q_PROPERTY(bool exposed READ exposed NOTIFY exposedChanged)
45 MirSurface(const QString& name,
48 MirSurface *parentSurface,
49 const QUrl& screenshot,
50 const QUrl &qmlFilePath = QUrl());
51 virtual ~MirSurface();
54 // unity.shell.application.MirSurface
56 Mir::Type type() const override;
58 QString name() const override;
60 QString persistentId() const override;
61 QString appId() const override;
63 QPoint position() const override { return m_position; }
65 QSize size() const override { return QSize(width(),height()); }
66 void resize(int width, int height) override;
67 void resize(const QSize &size) override { resize(size.width(), size.height()); }
70 Mir::State state() const override;
72 bool live() const override;
74 bool visible() const override;
76 Mir::OrientationAngle orientationAngle() const override;
77 void setOrientationAngle(Mir::OrientationAngle) override;
79 int minimumWidth() const override { return m_minimumWidth; }
80 int minimumHeight() const override { return m_minimumHeight; }
81 int maximumWidth() const override { return m_maximumWidth; }
82 int maximumHeight() const override { return m_maximumHeight; }
83 int widthIncrement() const override { return m_widthIncrement; }
84 int heightIncrement() const override { return m_heightIncrement; }
86 void setKeymap(const QString &) override;
87 QString keymap() const override;
89 Mir::ShellChrome shellChrome() const override;
91 bool focused() const override;
92 QRect inputBounds() const override;
94 bool confinesMousePointer() const override { return false; }
96 bool allowClientResize() const override { return true; }
97 void setAllowClientResize(bool) override {}
99 QPoint requestedPosition() const override { return m_requestedPosition; }
100 void setRequestedPosition(const QPoint &) override;
102 unity::shell::application::MirSurfaceInterface* parentSurface() const override;
103 unity::shell::application::MirSurfaceListInterface* childSurfaceList() const override;
105 Q_INVOKABLE void close() override;
106 Q_INVOKABLE void forceClose() override { }
107 Q_INVOKABLE void activate() override;
112 Q_INVOKABLE void requestFocus();
113 Q_INVOKABLE void setLive(bool live);
114 Q_INVOKABLE void setShellChrome(Mir::ShellChrome shellChrome);
119 bool isSlowToResize() const;
120 void setSlowToResize(bool value);
122 bool exposed() const { return m_exposed; }
124 Q_INVOKABLE void setMinimumWidth(int);
125 Q_INVOKABLE void setMaximumWidth(int);
126 Q_INVOKABLE void setMinimumHeight(int);
127 Q_INVOKABLE void setMaximumHeight(int);
128 Q_INVOKABLE void setWidthIncrement(int);
129 Q_INVOKABLE void setHeightIncrement(int);
131 Q_INVOKABLE virtual void setInputBounds(const QRect &boundsRect);
133 Q_INVOKABLE void openMenu(qreal x, qreal y, qreal width, qreal height);
134 Q_INVOKABLE void openDialog(qreal x, qreal y, qreal width, qreal height);
137 // internal mock stuff
139 QUrl qmlFilePath() const;
141 QUrl screenshotUrl() const;
142 void setScreenshotUrl(QUrl);
144 bool activeFocus() const;
145 void setActiveFocus(bool);
147 void registerView(qintptr viewId);
148 void unregisterView(qintptr viewId);
149 void setViewExposure(qintptr viewId, bool visible);
150 int viewCount() const { return m_views.count(); }
152 void setFocused(bool value);
154 void setState(Mir::State state);
156 Mir::State previousState() const { return m_previousState; }
157 void setPreviousState(Mir::State state) { m_previousState = state; }
161 // unity.shell.application.MirSurface
162 void requestState(Mir::State) override;
168 void heightChanged();
169 void slowToResizeChanged();
170 void exposedChanged(bool exposed);
173 // internal mock stuff
174 void screenshotUrlChanged(QUrl);
175 void activeFocusChanged(bool);
176 void closeRequested();
177 void stateRequested(Mir::State);
180 virtual void updateInputBoundsAfterResize();
183 void applyDelayedResize();
186 void doResize(int width, int height);
187 void updateExposure();
189 const QString m_name;
190 const Mir::Type m_type;
192 Mir::State m_previousState{Mir::UnknownState};
193 Mir::OrientationAngle m_orientationAngle;
195 QUrl m_screenshotUrl;
203 int m_minimumWidth{0};
204 int m_minimumHeight{0};
205 int m_maximumWidth{0};
206 int m_maximumHeight{0};
207 int m_widthIncrement{0};
208 int m_heightIncrement{0};
213 QTimer m_delayedResizeTimer;
214 QSize m_delayedResize;
215 QSize m_pendingResize;
217 Mir::ShellChrome m_shellChrome;
222 QHash<qintptr, View> m_views;
223 bool m_exposed{false};
225 QTimer m_zombieTimer;
230 QPoint m_requestedPosition;
232 unity::shell::application::MirSurfaceInterface* m_parentSurface;
234 MirSurfaceListModel *m_childSurfaceList;
237#endif // MOCK_MIR_SURFACE_H
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list