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 QObject *parent = nullptr);
46 virtual ~MirSurface();
49 // unity.shell.application.MirSurface
51 Mir::Type type() const override;
53 QString name() const override;
55 QSize size() const override { return QSize(width(),height()); }
56 void resize(int width, int height) override;
57 void resize(const QSize &size) override { resize(size.width(), size.height()); }
60 Mir::State state() const override;
61 Q_INVOKABLE void setState(Mir::State) override;
63 bool live() const override;
65 bool visible() const override;
67 Mir::OrientationAngle orientationAngle() const override;
68 void setOrientationAngle(Mir::OrientationAngle) override;
70 int minimumWidth() const override { return m_minimumWidth; }
71 int minimumHeight() const override { return m_minimumHeight; }
72 int maximumWidth() const override { return m_maximumWidth; }
73 int maximumHeight() const override { return m_maximumHeight; }
74 int widthIncrement() const override { return m_widthIncrement; }
75 int heightIncrement() const override { return m_heightIncrement; }
80 Q_INVOKABLE void setLive(bool live);
82 void registerView(qintptr viewId);
83 void unregisterView(qintptr viewId);
84 void setViewVisibility(qintptr viewId, bool visible);
85 int viewCount() const { return m_views.count(); }
90 bool isSlowToResize() const;
91 void setSlowToResize(bool value);
93 Q_INVOKABLE void setMinimumWidth(int);
94 Q_INVOKABLE void setMaximumWidth(int);
95 Q_INVOKABLE void setMinimumHeight(int);
96 Q_INVOKABLE void setMaximumHeight(int);
97 Q_INVOKABLE void setWidthIncrement(int);
98 Q_INVOKABLE void setHeightIncrement(int);
101 // internal mock stuff
103 QUrl qmlFilePath() const;
105 QUrl screenshotUrl() const;
106 void setScreenshotUrl(QUrl);
108 bool activeFocus() const;
109 void setActiveFocus(bool);
112 void stateChanged(Mir::State);
113 void liveChanged(bool live);
114 void orientationAngleChanged(Mir::OrientationAngle angle);
116 void heightChanged();
117 void slowToResizeChanged();
120 // internal mock stuff
121 void screenshotUrlChanged(QUrl);
122 void activeFocusChanged(bool);
125 void applyDelayedResize();
128 void doResize(int width, int height);
129 void updateVisibility();
131 const QString m_name;
132 const Mir::Type m_type;
134 Mir::OrientationAngle m_orientationAngle;
135 QUrl m_screenshotUrl;
143 int m_minimumWidth{0};
144 int m_minimumHeight{0};
145 int m_maximumWidth{0};
146 int m_maximumHeight{0};
147 int m_widthIncrement{0};
148 int m_heightIncrement{0};
151 QTimer m_delayedResizeTimer;
152 QSize m_delayedResize;
153 QSize m_pendingResize;
158 QHash<qintptr, View> m_views;
161#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