on xenial help sign in
more activecallhint tests
90ac277Nick Dedekind
tests/qmltests/Panel/tst_ActiveCallHint.qml+27−4
@@ -18,6 +18,7 @@ import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import Unity.Test 0.1 as UT
19import Unity.Test 0.1 as UT
20import Ubuntu.Telephony 0.1 as Telephony
20import Ubuntu.Telephony 0.1 as Telephony
21+import Unity.Application 0.1
21import ".."
22import ".."
22import "../../../qml/Panel"
23import "../../../qml/Panel"
23
24
@@ -68,19 +69,41 @@ Item {
68 callManager.foregroundCall = null;
69 callManager.foregroundCall = null;
69 callManager.backgroundCall = null;
70 callManager.backgroundCall = null;
70 callHint.labelSwitchInterval = 300;
71 callHint.labelSwitchInterval = 300;
72+
73+ ApplicationManager.stopApplication("dialer-app");
71 }
74 }
72
75
73 function test_activeHint_data() {
76 function test_activeHint_data() {
74 return [
77 return [
75− { tag: "empty", callIndicatorVisible: false },
78+ { tag: "noCall-callNotVisible", dialer: false, call: null, visible: false, expected: false },
76− { tag: "empty", callIndicatorVisible: true }
79+ { tag: "noCall-callVisible", dialer: false, call: null, visible: true, expected: false },
80+ { tag: "hasCall-callNotVisible", dialer: false, call: call1, visible: false, expected: true },
81+ { tag: "hasCall-callVisible", dialer: false, call: call1, visible: true, expected: true },
82+
83+ { tag: "dialerNotFocused-noCall-callNotVisible", dialer: true, focused: false, call: null, visible: false, expected: false },
84+ { tag: "dialerNotFocused-noCall-callVisible", dialer: true, focused: false, call: null, visible: true, expected: false },
85+ { tag: "dialerNotFocused-hasCall-callNotVisible", dialer: true, focused: false, call: call1, visible: false, expected: true },
86+ { tag: "dialerNotFocused-hasCall-callVisible", dialer: true, focused: false, call: call1, visible: true, expected: true },
87+
88+ { tag: "dialerFocused-noCall-callNotVisible", dialer: true, focused: true, call: null, visible: false, expected: false },
89+ { tag: "dialerFocused-noCall-callVisible", dialer: true, focused: true, call: null, visible: true, expected: true },
90+ { tag: "dialerFocused-hasCall-callNotVisible", dialer: true, focused: true, call: call1, visible: false, expected: false },
91+ { tag: "dialerFocused-hasCall-callVisible", dialer: true, focused: true, call: call1, visible: true, expected: true },
77 ];
92 ];
78 }
93 }
79
94
80 function test_activeHint(data) {
95 function test_activeHint(data) {
96+ if (data.dialer) {
97+ var application = ApplicationManager.startApplication("dialer-app");
98+ tryCompare(ApplicationManager, "focusedApplicationId", "dialer-app");
99+ tryCompare(application, "state", ApplicationInfo.Running);
100+
101+ if (!data.focused) { ApplicationManager.unfocusCurrentApplication(); }
102+ }
103+ callManager.foregroundCall = data.call;
81− callManager.callIndicatorVisible = data.callIndicatorVisible;
104+ callManager.callIndicatorVisible = data.visible;
82
105
83− compare(callHint.active, data.callIndicatorVisible, "Call hint should be active when callIndicatorVisible=true");
106+ compare(callHint.active, data.expected, "Call hint should be active when callIndicatorVisible=true");
84 }
107 }
85
108
86 function test_currentCall_data() {
109 function test_currentCall_data() {