on xenial help sign in
use call hint visibility api from telephony
commitd03a6a070f6f68968924a204d3bd0a366e674165 authorNick Dedekind <nicholas.dedekind@gmail.com> dateFri 20 Jun 2014, 17:22 (12 years ago) parent4e86d64
4 files changed+36−5
qml/Panel/ActiveCallHint.qml+1−1 tests/mocks/Ubuntu/Telephony/MockCallManager.cpp+15 tests/mocks/Ubuntu/Telephony/MockCallManager.h+5 tests/qmltests/Panel/tst_ActiveCallHint.qml+15−4
qml/Panel/ActiveCallHint.qml+1−1
@@ -23,7 +23,7 @@ import "../Components"
2323Item {
2424 id: callHint
2525
26− property bool active: callManager.hasCalls && ApplicationManager.focusedApplicationId !== "dialer-app"
26+ property bool active: callManager.callIndicatorVisible
2727 readonly property QtObject contactWatcher: _contactWatcher
2828 property int alternateLabelInterval: 4000
2929 property color color: Qt.rgba(0.1, 0.6, 0.1, 1.0)
tests/mocks/Ubuntu/Telephony/MockCallManager.cpp+15
@@ -22,6 +22,7 @@ MockCallManager::MockCallManager(QObject *parent)
2222 : QObject(parent)
2323 , m_foregroundCall(nullptr)
2424 , m_backgroundCall(nullptr)
25+ , m_callIndicatorVisible(false)
2526{
2627}
2728
@@ -63,3 +64,17 @@ bool MockCallManager::hasCalls() const
6364{
6465 return m_foregroundCall || m_backgroundCall;
6566}
67+
68+
69+bool MockCallManager::callIndicatorVisible() const
70+{
71+ return m_callIndicatorVisible;
72+}
73+
74+void MockCallManager::setCallIndicatorVisible(bool callIndicatorVisible)
75+{
76+ if(m_callIndicatorVisible != callIndicatorVisible){
77+ m_callIndicatorVisible = callIndicatorVisible;
78+ Q_EMIT callIndicatorVisibleChanged();
79+ }
80+}
tests/mocks/Ubuntu/Telephony/MockCallManager.h+5
@@ -29,6 +29,7 @@ class MockCallManager : public QObject
2929 Q_PROPERTY(QObject *foregroundCall READ foregroundCall WRITE setForegroundCall NOTIFY foregroundCallChanged)
3030 Q_PROPERTY(QObject *backgroundCall READ backgroundCall WRITE setBackgroundCall NOTIFY backgroundCallChanged)
3131 Q_PROPERTY(bool hasCalls READ hasCalls NOTIFY hasCallsChanged)
32+ Q_PROPERTY(bool callIndicatorVisible READ callIndicatorVisible WRITE setCallIndicatorVisible NOTIFY callIndicatorVisibleChanged)
3233
3334public:
3435 explicit MockCallManager(QObject *parent = 0);
@@ -38,18 +39,22 @@ public:
3839 QObject* foregroundCall() const;
3940 QObject* backgroundCall() const;
4041 bool hasCalls() const;
42+ bool callIndicatorVisible() const;
4143
4244 void setForegroundCall(QObject* foregroundCall);
4345 void setBackgroundCall(QObject* backgroundCall);
46+ void setCallIndicatorVisible(bool callIndicatorVisible);
4447
4548Q_SIGNALS:
4649 void foregroundCallChanged();
4750 void backgroundCallChanged();
4851 void hasCallsChanged();
52+ void callIndicatorVisibleChanged();
4953
5054private:
5155 QObject* m_foregroundCall;
5256 QObject* m_backgroundCall;
57+ bool m_callIndicatorVisible;
5358};
5459
5560#endif // MOCKCALLMANAGER_H
tests/qmltests/Panel/tst_ActiveCallHint.qml+15−4
@@ -70,7 +70,20 @@ Item {
7070 callHint.alternateLabelInterval = 300;
7171 }
7272
73− function test_activeCall_data() {
73+ function test_activeHint_data() {
74+ return [
75+ { tag: "empty", callIndicatorVisible: false },
76+ { tag: "empty", callIndicatorVisible: true }
77+ ];
78+ }
79+
80+ function test_activeHint(data) {
81+ callManager.callIndicatorVisible = data.callIndicatorVisible;
82+
83+ compare(callHint.active, data.callIndicatorVisible, "Call hint should be active when callIndicatorVisible=true");
84+ }
85+
86+ function test_currentCall_data() {
7487 return [
7588 { tag: "empty", foreground: null, background: null, active: false, label: "" },
7689 { tag: "foreground", foreground: call1, background: null, active: true, label: "+447812221111" },
@@ -79,12 +92,10 @@ Item {
7992 ];
8093 }
8194
82− function test_activeCall(data) {
95+ function test_currentCall(data) {
8396 callManager.foregroundCall = data.foreground;
8497 callManager.backgroundCall = data.background;
8598
86− compare(callHint.active, data.active, "Call hint active enabled does not match");
87−
8899 var contactLabel = findChild(callHint, "contactLabel");
89100 verify(contactLabel !== null);
90101