on xenial help sign in
Moved action-invocation signaling to C++-plugin.
commit342c203d65a7ab6fd1f69a622dfcbbc5fc0b75c4 authorMirco Müller <mirco.mueller@ubuntu.com> dateWed 21 Jan 2015, 18:44 (12 years ago) parent67f19bd
4 files changed+6−2
tests/mocks/Unity/Notifications/MockNotification.cpp+1 tests/mocks/Unity/Notifications/MockNotification.h+1 tests/mocks/Unity/Notifications/MockNotificationModel.h+3 tests/qmltests/Notifications/tst_Notifications.qml+1−2
tests/mocks/Unity/Notifications/MockNotification.cpp+1
@@ -164,6 +164,7 @@ void MockNotification::invokeAction(const QString &action) {
164164 for(int i=0; i<p->actions.size(); i++) {
165165 if(p->actions[i] == action) {
166166 Q_EMIT completed(p->id);
167+ Q_EMIT actionInvoked(action);
167168 return;
168169 }
169170 }
tests/mocks/Unity/Notifications/MockNotification.h+1
@@ -62,6 +62,7 @@ Q_SIGNALS:
6262
6363 void dataChanged(int nid);
6464 void completed(int nid);
65+ void actionInvoked(const QString &action);
6566
6667public:
6768 MockNotification(QObject *parent=nullptr);
tests/mocks/Unity/Notifications/MockNotificationModel.h+3
@@ -54,6 +54,9 @@ public:
5454
5555 int getCount() const;
5656
57+Q_SIGNALS:
58+ void actionInvoked(const QString &action);
59+
5760public Q_SLOTS:
5861 void onCompleted(int id);
5962
tests/qmltests/Notifications/tst_Notifications.qml+1−2
@@ -39,8 +39,6 @@ Item {
3939 NotificationModel {
4040 id: mockModel
4141
42− signal actionInvoked(string actionId)
43−
4442 // add the default/PlaceHolder notification to the model
4543 Component.onCompleted: {
4644 var component = Qt.createComponent("Notification.qml")
@@ -550,6 +548,7 @@ Item {
550548 function test_NotificationRenderer(data) {
551549 // hook up notification's completed-signal with model's onCompleted-slot, so that remove happens on close()
552550 data.n.completed.connect(mockModel.onCompleted)
551+ data.n.actionInvoked.connect(mockModel.actionInvoked)
553552
554553 // populate model with some mock notifications
555554 mockModel.append(data.n)