2 * Copyright (C) 2015 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>
28class MirSurface : public unity::shell::application::MirSurfaceInterface
33 // for use in qml tests
34 Q_PROPERTY(int width READ width NOTIFY widthChanged)
35 Q_PROPERTY(int height READ height NOTIFY heightChanged)
36 Q_PROPERTY(bool activeFocus READ activeFocus NOTIFY activeFocusChanged)
37 Q_PROPERTY(bool slowToResize READ isSlowToResize WRITE setSlowToResize NOTIFY slowToResizeChanged)
40 MirSurface(const QString& name,
43 const QUrl& screenshot,
44 const QUrl &qmlFilePath = QUrl());
45 virtual ~MirSurface();
48 // unity.shell.application.MirSurface
50 Mir::Type type() const override;
52 QString name() const override;
54 QSize size() const override { return QSize(width(),height()); }
55 void resize(int width, int height) override;
56 void resize(const QSize &size) override { resize(size.width(), size.height()); }
59 Mir::State state() const override;
60 Q_INVOKABLE void setState(Mir::State) override;
62 bool live() const override;
64 bool visible() const override;
66 Mir::OrientationAngle orientationAngle() const override;
67 void setOrientationAngle(Mir::OrientationAngle) override;
69 int minimumWidth() const override { return m_minimumWidth; }
70 int minimumHeight() const override { return m_minimumHeight; }
71 int maximumWidth() const override { return m_maximumWidth; }
72 int maximumHeight() const override { return m_maximumHeight; }
73 int widthIncrement() const override { return m_widthIncrement; }
74 int heightIncrement() const override { return m_heightIncrement; }
79 Q_INVOKABLE void setLive(bool live);
81 void registerView(qintptr viewId);
82 void unregisterView(qintptr viewId);
83 void setViewVisibility(qintptr viewId, bool visible);
84 int viewCount() const { return m_views.count(); }
89 bool isSlowToResize() const;
90 void setSlowToResize(bool value);
92 Q_INVOKABLE void setMinimumWidth(int);
93 Q_INVOKABLE void setMaximumWidth(int);
94 Q_INVOKABLE void setMinimumHeight(int);
95 Q_INVOKABLE void setMaximumHeight(int);
96 Q_INVOKABLE void setWidthIncrement(int);
97 Q_INVOKABLE void setHeightIncrement(int);
100 // internal mock stuff
102 QUrl qmlFilePath() const;
104 QUrl screenshotUrl() const;
105 void setScreenshotUrl(QUrl);
107 bool activeFocus() const;
108 void setActiveFocus(bool);
111 void stateChanged(Mir::State);
112 void liveChanged(bool live);
113 void orientationAngleChanged(Mir::OrientationAngle angle);
115 void heightChanged();
116 void slowToResizeChanged();
119 // internal mock stuff
120 void screenshotUrlChanged(QUrl);
121 void activeFocusChanged(bool);
124 void applyDelayedResize();
127 void doResize(int width, int height);
128 void updateVisibility();
130 const QString m_name;
131 const Mir::Type m_type;
133 Mir::OrientationAngle m_orientationAngle;
134 QUrl m_screenshotUrl;
142 int m_minimumWidth{0};
143 int m_minimumHeight{0};
144 int m_maximumWidth{0};
145 int m_maximumHeight{0};
146 int m_widthIncrement{0};
147 int m_heightIncrement{0};
150 QTimer m_delayedResizeTimer;
151 QSize m_delayedResize;
152 QSize m_pendingResize;
157 QHash<qintptr, View> m_views;
160#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