on xenial help sign in
Phew... now it works.
commita5a32d10c5a41360c392637544d5786e746486ed authorMirco Müller <mirco.mueller@ubuntu.com> dateTue 20 Jan 2015, 17:01 (12 years ago) parentf8c18e6
5 files changed+25−23
tests/mocks/Unity/Notifications/MockNotification.cpp+5−3 tests/mocks/Unity/Notifications/MockNotification.h+6−6 tests/mocks/Unity/Notifications/MockNotificationModel.cpp+7−7 tests/mocks/Unity/Notifications/MockNotificationModel.h+6−6 tests/qmltests/Notifications/tst_Notifications.qml+1−1
tests/mocks/Unity/Notifications/MockNotification.cpp+5−3
@@ -22,7 +22,7 @@
2222#include <QDebug>
2323
2424struct MockNotificationPrivate {
25− unsigned int id;
25+ int id;
2626 QString summary;
2727 QString body;
2828 int value;
@@ -65,12 +65,14 @@ void MockNotification::setBody(const QString &body) {
6565 }
6666}
6767
68−unsigned int MockNotification::getID() const {
68+int MockNotification::getID() const {
6969 return p->id;
7070}
7171
72−void MockNotification::setID(const unsigned int id) {
72+void MockNotification::setID(const int id) {
73+ qDebug() << "id: " << id;
7374 p->id = id;
75+ qDebug() << "id: " << p->id;
7476}
7577
7678int MockNotification::getValue() const {
tests/mocks/Unity/Notifications/MockNotification.h+6−6
@@ -33,7 +33,7 @@ class MockNotification : public QObject {
3333 Q_ENUMS(Type)
3434 Q_PROPERTY(QString summary READ getSummary WRITE setSummary NOTIFY summaryChanged)
3535 Q_PROPERTY(QString body READ getBody WRITE setBody NOTIFY bodyChanged)
36− Q_PROPERTY(unsigned int nid READ getID WRITE setID NOTIFY idChanged)
36+ Q_PROPERTY(int nid READ getID WRITE setID NOTIFY idChanged)
3737 Q_PROPERTY(int value READ getValue WRITE setValue NOTIFY valueChanged)
3838 Q_PROPERTY(QString icon READ getIcon WRITE setIcon NOTIFY iconChanged)
3939 Q_PROPERTY(QString secondaryIcon READ getSecondaryIcon WRITE setSecondaryIcon NOTIFY secondaryIconChanged)
@@ -52,7 +52,7 @@ public:
5252Q_SIGNALS:
5353 void summaryChanged(const QString &summary);
5454 void bodyChanged(const QString &body);
55− void idChanged(const unsigned int id);
55+ void idChanged(const int id);
5656 void valueChanged(int value);
5757 void iconChanged(const QString &icon);
5858 void secondaryIconChanged(const QString &secondaryIcon);
@@ -60,8 +60,8 @@ Q_SIGNALS:
6060 void actionsChanged(const QStringList &actions);
6161 void hintsChanged(const QVariantMap& hints);
6262
63− void dataChanged(unsigned int nid);
64− void completed(unsigned int nid);
63+ void dataChanged(int nid);
64+ void completed(int nid);
6565
6666public:
6767 MockNotification(QObject *parent=nullptr);
@@ -71,8 +71,8 @@ public:
7171 void setSummary(const QString &summary);
7272 QString getBody() const;
7373 void setBody(const QString &body);
74− unsigned int getID() const;
75− void setID(const unsigned int id);
74+ int getID() const;
75+ void setID(const int id);
7676 int getValue() const;
7777 void setValue(int value);
7878 QString getIcon() const;
tests/mocks/Unity/Notifications/MockNotificationModel.cpp+7−7
@@ -94,7 +94,7 @@ void MockNotificationModel::append(MockNotification* n) {
9494 endInsertRows();
9595}
9696
97−MockNotification* MockNotificationModel::getNotification(unsigned int id) const {
97+MockNotification* MockNotificationModel::getNotification(int id) const {
9898 for(int i=0; i < m_queue.size(); i++) {
9999 if(m_queue[i]->getID() == id) {
100100 return m_queue[i];
@@ -114,11 +114,11 @@ MockNotification* MockNotificationModel::getNotification(const QString &summary)
114114 return nullptr;
115115}
116116
117−bool MockNotificationModel::hasNotification(unsigned int id) const {
117+bool MockNotificationModel::hasNotification(int id) const {
118118 return !(getNotification(id) != nullptr);
119119}
120120
121−void MockNotificationModel::remove(const unsigned int id) {
121+void MockNotificationModel::remove(const int id) {
122122 qDebug() << "remove(" << id << ")";
123123 for(int i = 0; i < m_queue.size(); i++) {
124124 if(m_queue[i]->getID() == id) {
@@ -143,7 +143,7 @@ void MockNotificationModel::deleteFromVisible(int loc) {
143143 endRemoveRows();
144144}
145145
146−MockNotification* MockNotificationModel::getRaw(const unsigned int notificationId) const {
146+MockNotification* MockNotificationModel::getRaw(const int notificationId) const {
147147 for(int i = 0; i < m_queue.size(); i++) {
148148 if(m_queue[i]->getID() == notificationId) {
149149 MockNotification* n = m_queue[i];
@@ -163,7 +163,7 @@ QHash<int, QByteArray> MockNotificationModel::roleNames() const {
163163
164164 roles.insert(ModelInterface::RoleType, "type");
165165 roles.insert(ModelInterface::RoleUrgency, "urgency");
166− roles.insert(ModelInterface::RoleId, "nid");
166+ roles.insert(ModelInterface::RoleId, "id");
167167 roles.insert(ModelInterface::RoleSummary, "summary");
168168 roles.insert(ModelInterface::RoleBody, "body");
169169 roles.insert(ModelInterface::RoleValue, "value");
@@ -176,12 +176,12 @@ QHash<int, QByteArray> MockNotificationModel::roleNames() const {
176176 return roles;
177177}
178178
179−void MockNotificationModel::onCompleted(unsigned int id) {
179+void MockNotificationModel::onCompleted(int id) {
180180 qDebug() << "onCompleted(" << id << ")";
181181 remove(id);
182182}
183183
184−void MockNotificationModel::onDataChanged(unsigned int id) {
184+void MockNotificationModel::onDataChanged(int id) {
185185 for(int i = 0; i < m_queue.size(); i++) {
186186 if(m_queue[i]->getID() == id) {
187187 Q_EMIT dataChanged(index(i, 0), index(i, 0));
tests/mocks/Unity/Notifications/MockNotificationModel.h+6−6
@@ -40,24 +40,24 @@ public:
4040 virtual QHash<int, QByteArray> roleNames() const;
4141
4242 Q_INVOKABLE void append(MockNotification* n);
43− MockNotification* getNotification(unsigned int id) const;
43+ MockNotification* getNotification(int id) const;
4444 MockNotification* getNotification(const QString &summary) const;
45− bool hasNotification(unsigned int id) const;
45+ bool hasNotification(int id) const;
4646
4747 // getRaw() is only meant to be used from QML, since QML cannot handle
4848 // QSharedPointers... on C++-side only use getNotification()
49− Q_INVOKABLE MockNotification* getRaw(const unsigned int notificationId) const;
49+ Q_INVOKABLE MockNotification* getRaw(const int notificationId) const;
5050
5151 Q_INVOKABLE int queued() const;
52− Q_INVOKABLE void remove(const unsigned int id);
52+ Q_INVOKABLE void remove(const int id);
5353
5454 int getCount() const;
5555
5656public Q_SLOTS:
57− void onCompleted(unsigned int id);
57+ void onCompleted(int id);
5858
5959private Q_SLOTS:
60− void onDataChanged(unsigned int id);
60+ void onDataChanged(int id);
6161
6262Q_SIGNALS:
6363 void queueSizeChanged(int newSize);
tests/qmltests/Notifications/tst_Notifications.qml+1−1
@@ -113,7 +113,7 @@ Item {
113113 secondaryIcon: ""
114114 rawActions: ["reply_id", "Dummy"]
115115 Component.onCompleted: {
116− n5.completed.connect(mockModel.remove)
116+ n5.completed.connect(mockModel.onCompleted)
117117 }
118118 },
119119 Notification {