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;
72 Q_INVOKABLE void setLive(bool live);
74 void registerView(qintptr viewId);
75 void unregisterView(qintptr viewId);
76 void setViewVisibility(qintptr viewId, bool visible);
77 int viewCount() const { return m_views.count(); }
82 bool isSlowToResize() const;
83 void setSlowToResize(bool value);
86 // internal mock stuff
88 QUrl qmlFilePath() const;
90 QUrl screenshotUrl() const;
91 void setScreenshotUrl(QUrl);
93 bool activeFocus() const;
94 void setActiveFocus(bool);
97 void stateChanged(Mir::State);
98 void liveChanged(bool live);
99 void orientationAngleChanged(Mir::OrientationAngle angle);
101 void heightChanged();
102 void slowToResizeChanged();
105 // internal mock stuff
106 void screenshotUrlChanged(QUrl);
107 void activeFocusChanged(bool);
110 void applyDelayedResize();
113 void doResize(int width, int height);
114 void updateVisibility();
116 const QString m_name;
117 const Mir::Type m_type;
119 Mir::OrientationAngle m_orientationAngle;
120 QUrl m_screenshotUrl;
129 QTimer m_delayedResizeTimer;
130 QSize m_delayedResize;
131 QSize m_pendingResize;
136 QHash<qintptr, View> m_views;
139#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