on 19bfe13 help sign in
unity8/tests/mocks/Unity/Notifications/MockNotification.h
101 lines 3.6 kB history raw
1/*
2 * Copyright 2015 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
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 Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Mirco Mueller <mirco.mueller@canonical.com>
18 */
20#ifndef MOCK_NOTIFICATION_H
21#define MOCK_NOTIFICATION_H
23#include "MockActionModel.h"
24#include <QObject>
25#include <QString>
26#include <QStringList>
27#include <QScopedPointer>
29struct MockNotificationPrivate;
31class MockNotification : public QObject {
32 Q_OBJECT
33 Q_PROPERTY(QString summary READ getSummary WRITE setSummary NOTIFY summaryChanged)
34 Q_PROPERTY(QString body READ getBody WRITE setBody NOTIFY bodyChanged)
35 Q_PROPERTY(int nid READ getID WRITE setID NOTIFY idChanged)
36 Q_PROPERTY(int value READ getValue WRITE setValue NOTIFY valueChanged)
37 Q_PROPERTY(QString icon READ getIcon WRITE setIcon NOTIFY iconChanged)
38 Q_PROPERTY(QString secondaryIcon READ getSecondaryIcon WRITE setSecondaryIcon NOTIFY secondaryIconChanged)
39 Q_PROPERTY(Type type READ getType WRITE setType NOTIFY typeChanged)
40 Q_PROPERTY(QStringList rawActions READ rawActions WRITE setActions)
41 Q_PROPERTY(ActionModel* actions READ getActions NOTIFY actionsChanged)
42 Q_PROPERTY(QVariantMap hints READ getHints WRITE setHints NOTIFY hintsChanged)
43 Q_PROPERTY(bool fullscreen READ fullscreen WRITE setFullscreen NOTIFY fullscreenChanged) // only in mock
45private:
46 QScopedPointer<MockNotificationPrivate> p;
48public:
49 enum Urgency { Low, Normal, Critical };
50 Q_ENUM(Urgency)
51 enum Type { PlaceHolder, Confirmation, Ephemeral, Interactive, SnapDecision };
52 Q_ENUM(Type)
54Q_SIGNALS:
55 void summaryChanged(const QString &summary);
56 void bodyChanged(const QString &body);
57 void idChanged(const int id);
58 void valueChanged(int value);
59 void iconChanged(const QString &icon);
60 void secondaryIconChanged(const QString &secondaryIcon);
61 void typeChanged(Type type);
62 void actionsChanged(const QStringList &actions);
63 void hintsChanged(const QVariantMap& hints);
65 void dataChanged(int nid);
66 void completed(int nid);
67 void actionInvoked(const QString &action);
69 void fullscreenChanged(bool fullscreen);
71public:
72 MockNotification(QObject *parent=nullptr);
73 virtual ~MockNotification();
75 QString getSummary() const;
76 void setSummary(const QString &summary);
77 QString getBody() const;
78 void setBody(const QString &body);
79 int getID() const;
80 void setID(const int id);
81 int getValue() const;
82 void setValue(int value);
83 QString getIcon() const;
84 void setIcon(const QString &icon);
85 QString getSecondaryIcon() const;
86 void setSecondaryIcon(const QString &secondaryIcon);
87 Type getType() const;
88 void setType(Type type);
89 ActionModel* getActions() const;
90 QStringList rawActions() const;
91 void setActions(const QStringList &actions);
92 QVariantMap getHints() const;
93 void setHints(const QVariantMap& hints);
94 bool fullscreen() const;
95 void setFullscreen(bool fullscreen);
97 Q_INVOKABLE void invokeAction(const QString &action);
98 Q_INVOKABLE void close();
99};
101#endif // MOCK_NOTIFICATION_H