on xenial help sign in
Moved action-invocation signaling to C++-plugin.
342c203Mirco Müller
tests/mocks/Unity/Notifications/MockNotification.cpp+1
@@ -164,6 +164,7 @@ void MockNotification::invokeAction(const QString &action) {
164 for(int i=0; i<p->actions.size(); i++) {
164 for(int i=0; i<p->actions.size(); i++) {
165 if(p->actions[i] == action) {
165 if(p->actions[i] == action) {
166 Q_EMIT completed(p->id);
166 Q_EMIT completed(p->id);
167+ Q_EMIT actionInvoked(action);
167 return;
168 return;
168 }
169 }
169 }
170 }
tests/mocks/Unity/Notifications/MockNotification.h+1
@@ -62,6 +62,7 @@ Q_SIGNALS:
62
62
63 void dataChanged(int nid);
63 void dataChanged(int nid);
64 void completed(int nid);
64 void completed(int nid);
65+ void actionInvoked(const QString &action);
65
66
66public:
67public:
67 MockNotification(QObject *parent=nullptr);
68 MockNotification(QObject *parent=nullptr);
tests/mocks/Unity/Notifications/MockNotificationModel.h+3
@@ -54,6 +54,9 @@ public:
54
54
55 int getCount() const;
55 int getCount() const;
56
56
57+Q_SIGNALS:
58+ void actionInvoked(const QString &action);
59+
57public Q_SLOTS:
60public Q_SLOTS:
58 void onCompleted(int id);
61 void onCompleted(int id);
59
62
tests/qmltests/Notifications/tst_Notifications.qml+1−2
@@ -39,8 +39,6 @@ Item {
39 NotificationModel {
39 NotificationModel {
40 id: mockModel
40 id: mockModel
41
41
42− signal actionInvoked(string actionId)
43−
44 // add the default/PlaceHolder notification to the model
42 // add the default/PlaceHolder notification to the model
45 Component.onCompleted: {
43 Component.onCompleted: {
46 var component = Qt.createComponent("Notification.qml")
44 var component = Qt.createComponent("Notification.qml")
@@ -550,6 +548,7 @@ Item {
550 function test_NotificationRenderer(data) {
548 function test_NotificationRenderer(data) {
551 // hook up notification's completed-signal with model's onCompleted-slot, so that remove happens on close()
549 // hook up notification's completed-signal with model's onCompleted-slot, so that remove happens on close()
552 data.n.completed.connect(mockModel.onCompleted)
550 data.n.completed.connect(mockModel.onCompleted)
551+ data.n.actionInvoked.connect(mockModel.actionInvoked)
553
552
554 // populate model with some mock notifications
553 // populate model with some mock notifications
555 mockModel.append(data.n)
554 mockModel.append(data.n)