on xenial help sign in
Fix testNotifications
commit475c3b83a140885480cb7283afb20cd013113073 authorAlbert Astals Cid <albert.astals@canonical.com> dateWed 2 Sep 2015, 12:17 (11 years ago) parente0112a4
2 files changed+12−4
tests/mocks/Powerd/Powerd.cpp+7−2 tests/mocks/Powerd/Powerd.h+5−2
tests/mocks/Powerd/Powerd.cpp+7−2
@@ -24,11 +24,16 @@ Powerd::Powerd(QObject* parent)
2424{
2525}
2626
27−void Powerd::setStatus(Powerd::Status status)
27+void Powerd::setStatusForTests(Powerd::Status status)
28+{
29+ setStatus(status, DisplayStateChangeReason::Unknown);
30+}
31+
32+void Powerd::setStatus(Powerd::Status status, DisplayStateChangeReason reason)
2833{
2934 if (m_status != status) {
3035 m_status = status;
31− Q_EMIT statusChanged(DisplayStateChangeReason::Unknown);
36+ Q_EMIT statusChanged(reason);
3237 }
3338}
3439
tests/mocks/Powerd/Powerd.h+5−2
@@ -26,7 +26,7 @@ class Powerd: public QObject
2626 Q_OBJECT
2727 Q_ENUMS(Status)
2828 Q_ENUMS(DisplayStateChangeReason)
29− Q_PROPERTY(Status status READ status WRITE setStatus NOTIFY statusChanged) // write only exists for tests
29+ Q_PROPERTY(Status status READ status WRITE setStatusForTests NOTIFY statusChanged) // write only exists for tests
3030
3131public:
3232 enum DisplayStateChangeReason {
@@ -44,7 +44,10 @@ public:
4444 explicit Powerd(QObject *parent = 0);
4545
4646 Status status() const;
47− void setStatus(Status status);
47+ void setStatusForTests(Status status);
48+
49+ // Not exposed via Q_PROPERTY because we need the 'reason' argument too
50+ Q_INVOKABLE void setStatus(Status status, DisplayStateChangeReason reason);
4851
4952Q_SIGNALS:
5053 void statusChanged(DisplayStateChangeReason reason);