Merge lp:~tiagosh/dialer-app/emergency-calls-libphonenumber into lp:dialer-app

Proposed by Tiago Salem Herrmann
Status: Merged
Approved by: Gustavo Pichorim Boiko
Approved revision: 445
Merged at revision: 453
Proposed branch: lp:~tiagosh/dialer-app/emergency-calls-libphonenumber
Merge into: lp:dialer-app
Diff against target: 455 lines (+203/-35)
8 files modified
debian/control (+0/-1)
src/dialerapplication.cpp (+1/-1)
src/qml/DialerPage/DialerPage.qml (+42/-12)
src/qml/Dialogs/NoDefaultSIMCardDialog.qml (+2/-2)
src/qml/LiveCallPage/LiveCall.qml (+6/-0)
src/qml/dialer-app.qml (+26/-7)
tests/qml/CMakeLists.txt (+1/-10)
tests/qml/tst_DialerPage.qml (+125/-2)
To merge this branch: bzr merge lp:~tiagosh/dialer-app/emergency-calls-libphonenumber
Reviewer Review Type Date Requested Status
Gustavo Pichorim Boiko (community) Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+264908@code.launchpad.net

Commit message

Improve emergency number validation with libphonenumber.

Description of the change

Improve emergency number validation with libphonenumber.

--Checklist--
Are there any related MPs required for this MP to build/function as expected? Please list.
https://code.launchpad.net/~tiagosh/telephony-service/check-contact-watcher-results/+merge/266631
https://code.launchpad.net/~tiagosh/telephony-service/use-libphonenumber/+merge/264906

Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)
Yes

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?
Yes

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/<package-name>) on device or emulator?
Yes

If you changed the UI, was the change specified/approved by design?
N/A

If you changed UI labels, did you update the pot file?
N/A

If you changed the packaging (debian), did you add a core-dev as a reviewer to this MP?
N/A

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
435. By Tiago Salem Herrmann

use countryCode when checking for emergency numbers

436. By Tiago Salem Herrmann

fix comments

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
437. By Tiago Salem Herrmann

Use the selected account if available, otherwise fallback to any other account

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
438. By Tiago Salem Herrmann

Use string comparison for emergency numbers coming from the sim card

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
439. By Tiago Salem Herrmann

Keep call button always enabled
Fill entry with last called number when the entry is empty and call button is pressed

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
440. By Tiago Salem Herrmann

Allow calling any number if no sims are present

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
441. By Tiago Salem Herrmann

Provide initial status and phone to live call when making a call

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
442. By Tiago Salem Herrmann

update method signature

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

Just a couple remarks, other than that I think it would be nice to try to add some tests, maybe QML tests?

review: Needs Fixing
443. By Tiago Salem Herrmann

improve comparison

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
444. By Tiago Salem Herrmann

add tests

445. By Tiago Salem Herrmann

remove dbus-test-runner

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?
Yes

Did CI run pass? If not, please explain why.
No, needs changes in telephony-service.

Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?
Yes

Looks good and works as expected!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2015-05-14 17:01:14 +0000
+++ debian/control 2015-08-07 21:34:02 +0000
@@ -3,7 +3,6 @@
3Priority: optional3Priority: optional
4Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>4Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
5Build-Depends: cmake,5Build-Depends: cmake,
6 dbus-test-runner,
7 debhelper (>= 9),6 debhelper (>= 9),
8 dh-translations,7 dh-translations,
9 pkg-config,8 pkg-config,
109
=== modified file 'src/dialerapplication.cpp'
--- src/dialerapplication.cpp 2015-05-12 14:33:45 +0000
+++ src/dialerapplication.cpp 2015-08-07 21:34:02 +0000
@@ -227,7 +227,7 @@
227 QUrlQuery query(url);227 QUrlQuery query(url);
228 QString viewName = query.queryItemValue("view");228 QString viewName = query.queryItemValue("view");
229 if (viewName == "liveCall") {229 if (viewName == "liveCall") {
230 QMetaObject::invokeMethod(mainView, "switchToLiveCall");230 QMetaObject::invokeMethod(mainView, "switchToLiveCall", Q_ARG(QVariant, QVariant()), Q_ARG(QVariant, QVariant()));
231 }231 }
232232
233 }233 }
234234
=== modified file 'src/qml/DialerPage/DialerPage.qml'
--- src/qml/DialerPage/DialerPage.qml 2015-07-17 09:01:20 +0000
+++ src/qml/DialerPage/DialerPage.qml 2015-08-07 21:34:02 +0000
@@ -263,6 +263,7 @@
263263
264 KeypadEntry {264 KeypadEntry {
265 id: keypadEntry265 id: keypadEntry
266 objectName: "keypadEntry"
266267
267 anchors {268 anchors {
268 top: parent.top269 top: parent.top
@@ -401,20 +402,49 @@
401 horizontalCenter: parent.horizontalCenter402 horizontalCenter: parent.horizontalCenter
402 }403 }
403 onClicked: {404 onClicked: {
405 if (dialNumber == "") {
406 if (mainView.greeterMode) {
407 return;
408 }
409 keypadEntry.value = generalSettings.lastCalledPhoneNumber
410 return;
411 }
412
413 if (mainView.greeterMode && !mainView.isEmergencyNumber(dialNumber)) {
414 // we only allow users to call any number in greeter mode if there are
415 // no sim cards present. The operator will block the number if it thinks
416 // it's necessary.
417 // for phone accounts, active means the the status is not offline:
418 // "nomodem", "nosim" or "flightmode"
419
420 var denyEmergencyCall = false
421 // while in flight mode we can't detect if sims are present in some devices
422 if (telepathyHelper.flightMode) {
423 denyEmergencyCall = true
424 } else {
425 for (var i in telepathyHelper.activeAccounts) {
426 var account = telepathyHelper.activeAccounts[i]
427 if (account.type == AccountEntry.PhoneAccount) {
428 denyEmergencyCall = true;
429 }
430 }
431 }
432 if (denyEmergencyCall) {
433 // if there is at least one sim card present, just ignore the call
434 showNotification(i18n.tr("Emergency call"), i18n.tr("This is not an emergency number."))
435 keypadEntry.value = "";
436 return;
437 }
438
439 // this is a special case, we need to call using callEmergency() directly to avoid
440 // all network and dual sim checks we have in mainView.call()
441 mainView.callEmergency(keypadEntry.value)
442 return;
443 }
444
404 console.log("Starting a call to " + keypadEntry.value);445 console.log("Starting a call to " + keypadEntry.value);
405 mainView.call(keypadEntry.value);446 mainView.call(keypadEntry.value);
406 }447 }
407 enabled: {
408 if (dialNumber == "") {
409 return false;
410 }
411
412 if (mainView.greeterMode) {
413 return mainView.isEmergencyNumber(dialNumber);
414 }
415
416 return true;
417 }
418 }448 }
419 }449 }
420450
@@ -443,7 +473,7 @@
443 }473 }
444 ScriptAction {474 ScriptAction {
445 script: {475 script: {
446 mainView.switchToLiveCall()476 mainView.switchToLiveCall(i18n.tr("Calling"), keypadEntry.value)
447 keypadEntry.value = ""477 keypadEntry.value = ""
448 callButton.iconRotation = 0.0478 callButton.iconRotation = 0.0
449 keypadContainer.opacity = 1.0479 keypadContainer.opacity = 1.0
450480
=== modified file 'src/qml/Dialogs/NoDefaultSIMCardDialog.qml'
--- src/qml/Dialogs/NoDefaultSIMCardDialog.qml 2014-08-15 21:18:20 +0000
+++ src/qml/Dialogs/NoDefaultSIMCardDialog.qml 2015-08-07 21:34:02 +0000
@@ -70,7 +70,7 @@
70 text: i18n.tr("No")70 text: i18n.tr("No")
71 color: UbuntuColors.orange71 color: UbuntuColors.orange
72 onClicked: {72 onClicked: {
73 settings.mainViewDontAskCount = 373 dualSimSettings.mainViewDontAskCount = 3
74 PopupUtils.close(dialogue)74 PopupUtils.close(dialogue)
75 Qt.inputMethod.hide()75 Qt.inputMethod.hide()
76 }76 }
@@ -81,7 +81,7 @@
81 color: UbuntuColors.orange81 color: UbuntuColors.orange
82 onClicked: {82 onClicked: {
83 PopupUtils.close(dialogue)83 PopupUtils.close(dialogue)
84 settings.mainViewDontAskCount++84 dualSimSettings.mainViewDontAskCount++
85 Qt.inputMethod.hide()85 Qt.inputMethod.hide()
86 }86 }
87 }87 }
8888
=== modified file 'src/qml/LiveCallPage/LiveCall.qml'
--- src/qml/LiveCallPage/LiveCall.qml 2015-07-16 21:45:42 +0000
+++ src/qml/LiveCallPage/LiveCall.qml 2015-08-07 21:34:02 +0000
@@ -43,6 +43,8 @@
43 property variant audioOutputs: call ? call.audioOutputs : null43 property variant audioOutputs: call ? call.audioOutputs : null
44 property string phoneNumberSubTypeLabel: ""44 property string phoneNumberSubTypeLabel: ""
45 property int defaultTimeout: 1000045 property int defaultTimeout: 10000
46 property string initialStatus: ""
47 property string initialNumber: ""
46 property string caller: {48 property string caller: {
47 if (call && call.isConference) {49 if (call && call.isConference) {
48 return i18n.tr("Conference");50 return i18n.tr("Conference");
@@ -50,6 +52,8 @@
50 return contactWatcher.alias;52 return contactWatcher.alias;
51 } else if (contactWatcher.identifier !== "") {53 } else if (contactWatcher.identifier !== "") {
52 return contactWatcher.identifier;54 return contactWatcher.identifier;
55 } else if (!call && initialNumber != "") {
56 return initialNumber
53 } else {57 } else {
54 return " "58 return " "
55 }59 }
@@ -444,6 +448,8 @@
444 return call.held ? i18n.tr("%1 - on hold").arg(stopWatch.elapsed) : stopWatch.elapsed;448 return call.held ? i18n.tr("%1 - on hold").arg(stopWatch.elapsed) : stopWatch.elapsed;
445 } else if (call && !call.incoming) {449 } else if (call && !call.incoming) {
446 return i18n.tr("Calling")450 return i18n.tr("Calling")
451 } else if (!call && initialStatus !== "") {
452 return initialStatus
447 } else {453 } else {
448 return " "454 return " "
449 }455 }
450456
=== modified file 'src/qml/dialer-app.qml'
--- src/qml/dialer-app.qml 2015-06-09 22:02:19 +0000
+++ src/qml/dialer-app.qml 2015-08-07 21:34:02 +0000
@@ -90,7 +90,7 @@
90 onSetupReady: {90 onSetupReady: {
91 telepathyReady = true91 telepathyReady = true
92 if (multipleAccounts && !telepathyHelper.defaultCallAccount &&92 if (multipleAccounts && !telepathyHelper.defaultCallAccount &&
93 settings.mainViewDontAskCount < 3 && pageStackNormalMode.depth === 1 && !mainView.greeterMode) {93 dualSimSettings.mainViewDontAskCount < 3 && pageStackNormalMode.depth === 1 && !mainView.greeterMode) {
94 PopupUtils.open(Qt.createComponent("Dialogs/NoDefaultSIMCardDialog.qml").createObject(mainView))94 PopupUtils.open(Qt.createComponent("Dialogs/NoDefaultSIMCardDialog.qml").createObject(mainView))
95 }95 }
96 }96 }
@@ -111,12 +111,17 @@
111 }111 }
112112
113 Settings {113 Settings {
114 id: settings114 id: dualSimSettings
115 category: "DualSim"115 category: "DualSim"
116 property bool dialPadDontAsk: false116 property bool dialPadDontAsk: false
117 property int mainViewDontAskCount: 0117 property int mainViewDontAskCount: 0
118 }118 }
119119
120 Settings {
121 id: generalSettings
122 property string lastCalledPhoneNumber: ""
123 }
124
120 PhoneUtils {125 PhoneUtils {
121 id: phoneUtils126 id: phoneUtils
122 }127 }
@@ -166,13 +171,21 @@
166 ]171 ]
167172
168 function isEmergencyNumber(number) {173 function isEmergencyNumber(number) {
174 // TODO should we only check for emergency numbers
175 // in the selected account?
176
177 // check for specific account emergency numbers
169 for (var i in telepathyHelper.accounts) {178 for (var i in telepathyHelper.accounts) {
170 var account = telepathyHelper.accounts[i];179 var account = telepathyHelper.accounts[i];
171 for (var j in account.emergencyNumbers) {180 for (var j in account.emergencyNumbers) {
172 if (phoneUtils.comparePhoneNumbers(number, account.emergencyNumbers[j])) {181 if (number == account.emergencyNumbers[j]) {
173 return true;182 return true;
174 }183 }
175 }184 }
185 // then check using libphonenumber
186 if (phoneUtils.isEmergencyNumber(number, account.countryCode)) {
187 return true;
188 }
176 }189 }
177 return false;190 return false;
178 }191 }
@@ -264,9 +277,12 @@
264277
265 animateLiveCall();278 animateLiveCall();
266279
267 // now try to use one of the connected accounts
268 var account = null;280 var account = null;
269 if (telepathyHelper.activeAccounts.length > 0) {281 // check if the selected account is active and can make emergency calls
282 if (mainView.account && mainView.account.active && mainView.account.emergencyCallsAvailable) {
283 account = mainView.account
284 } else if (telepathyHelper.activeAccounts.length > 0) {
285 // now try to use one of the connected accounts
270 account = telepathyHelper.activeAccounts[0];286 account = telepathyHelper.activeAccounts[0];
271 } else {287 } else {
272 // if no account is active, use any account that can make emergency calls288 // if no account is active, use any account that can make emergency calls
@@ -317,7 +333,7 @@
317 return333 return
318 }334 }
319335
320 if (multipleAccounts && !telepathyHelper.defaultCallAccount && !settings.dialPadDontAsk && !skipDefaultSimDialog) {336 if (multipleAccounts && !telepathyHelper.defaultCallAccount && !dualSimSettings.dialPadDontAsk && !skipDefaultSimDialog) {
321 var properties = {}337 var properties = {}
322 properties["phoneNumber"] = number338 properties["phoneNumber"] = number
323 properties["accountId"] = mainView.account.accountId339 properties["accountId"] = mainView.account.accountId
@@ -359,6 +375,7 @@
359 }375 }
360376
361 if (account && account.connected) {377 if (account && account.connected) {
378 generalSettings.lastCalledPhoneNumber = number
362 callManager.startCall(number, account.accountId);379 callManager.startCall(number, account.accountId);
363 }380 }
364 }381 }
@@ -409,13 +426,15 @@
409 }426 }
410 }427 }
411428
412 function switchToLiveCall() {429 function switchToLiveCall(initialStatus, initialNumber) {
413 if (pageStackNormalMode.depth > 2 && pageStackNormalMode.currentPage.objectName == "contactsPage") {430 if (pageStackNormalMode.depth > 2 && pageStackNormalMode.currentPage.objectName == "contactsPage") {
414 // pop contacts Page431 // pop contacts Page
415 pageStackNormalMode.pop();432 pageStackNormalMode.pop();
416 }433 }
417434
418 var properties = {}435 var properties = {}
436 properties["initialStatus"] = initialStatus
437 properties["initialNumber"] = initialNumber
419 if (isEmergencyNumber(pendingNumberToDial)) {438 if (isEmergencyNumber(pendingNumberToDial)) {
420 properties["defaultTimeout"] = 30000439 properties["defaultTimeout"] = 30000
421 }440 }
422441
=== modified file 'tests/qml/CMakeLists.txt'
--- tests/qml/CMakeLists.txt 2015-05-21 18:52:21 +0000
+++ tests/qml/CMakeLists.txt 2015-08-07 21:34:02 +0000
@@ -15,21 +15,12 @@
15 )15 )
16endmacro()16endmacro()
1717
18macro(DECLARE_QML_DBUS_TEST TST_NAME TST_QML_FILE)
19 add_test(NAME ${TST_NAME}
20 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
21 COMMAND ${XVFB_RUN_BIN} -a -s "-screen 0 1024x768x24" dbus-test-runner --task /usr/bin/history-daemon --ignore-return --task /usr/bin/telephony-service-handler --ignore-return --task=${QMLTESTRUNNER_BIN} --parameter=-v1 --parameter=-o --parameter=-,txt --parameter=-o --parameter=${CMAKE_BINARY_DIR}/test_${TST_NAME}.xml,xunitxml --parameter=-import --parameter=${qml_BINARY_DIR} --parameter=-input --parameter=${CMAKE_CURRENT_SOURCE_DIR}/${TST_QML_FILE}
22 )
23 set_tests_properties(${TST_NAME} PROPERTIES ENVIRONMENT "QT_QPA_FONTDIR=${CMAKE_BINARY_DIR}")
24endmacro()
25
26if(QMLTESTRUNNER_BIN AND XVFB_RUN_BIN)18if(QMLTESTRUNNER_BIN AND XVFB_RUN_BIN)
27 declare_qml_test("keypad_button" tst_KeypadButton.qml)19 declare_qml_test("keypad_button" tst_KeypadButton.qml)
28 declare_qml_test("main_view" tst_MainView.qml)20 declare_qml_test("main_view" tst_MainView.qml)
29 declare_qml_test("stopwatch" tst_StopWatch.qml)21 declare_qml_test("stopwatch" tst_StopWatch.qml)
30 declare_qml_test("historydelegate" tst_HistoryDelegate.qml)22 declare_qml_test("historydelegate" tst_HistoryDelegate.qml)
31# FIXME currently disabled. There is a bug when registering the telepathy observer23 declare_qml_test("dialer_page" tst_DialerPage.qml)
32# declare_qml_dbus_test("dialer_page" tst_DialerPage.qml)
33else()24else()
34 if (NOT QMLTESTRUNNER_BIN)25 if (NOT QMLTESTRUNNER_BIN)
35 message(WARNING "Qml tests disabled: qmltestrunner not found")26 message(WARNING "Qml tests disabled: qmltestrunner not found")
3627
=== modified file 'tests/qml/tst_DialerPage.qml'
--- tests/qml/tst_DialerPage.qml 2015-03-30 20:09:13 +0000
+++ tests/qml/tst_DialerPage.qml 2015-08-07 21:34:02 +0000
@@ -19,6 +19,7 @@
19import QtQuick 2.219import QtQuick 2.2
20import QtTest 1.020import QtTest 1.0
21import Ubuntu.Test 0.121import Ubuntu.Test 0.1
22import Ubuntu.Telephony 0.1
2223
23Item {24Item {
24 id: root25 id: root
@@ -38,6 +39,43 @@
38 property bool greeterActive: false39 property bool greeterActive: false
39 }40 }
4041
42 QtObject {
43 id: testAccount
44 property string accountId: "ofono/ofono/account0"
45 property var emergencyNumbers: [ "444", "555"]
46 property int type: AccountEntry.PhoneAccount
47 property string displayName: "SIM 1"
48 property bool connected: true
49 property bool emergencyCallsAvailable: true
50 property bool active: true
51 property string networkName: "Network name"
52 property bool simLocked: false
53 }
54
55 Item {
56 id: telepathyHelper
57 function registerChannelObserver() {}
58 function unregisterChannelObserver() {}
59 property bool emergencyCallsAvailable: true
60 property bool flightMode: false
61 property var activeAccounts: [testAccount]
62 property alias accounts: telepathyHelper.activeAccounts
63 }
64
65 Item {
66 id: callManager
67 signal callStarted
68 function startCall(phoneNumber, accountId) {
69 callManager.callStarted(phoneNumber, accountId)
70 }
71 }
72
73 SignalSpy {
74 id: callSpy
75 target: callManager
76 signalName: "callStarted"
77 }
78
41 Loader {79 Loader {
42 id: mainViewLoader80 id: mainViewLoader
43 property string i18nDirectory: ""81 property string i18nDirectory: ""
@@ -57,15 +95,17 @@
57 }95 }
5896
59 function test_dialerPageHeaderTitleWhenAppIsInBackground() {97 function test_dialerPageHeaderTitleWhenAppIsInBackground() {
98 mainViewLoader.item.switchToKeypadView()
60 tryCompare(mainViewLoader.item, 'applicationActive', true)99 tryCompare(mainViewLoader.item, 'applicationActive', true)
61 tryCompare(mainViewLoader.item.currentStack, 'depth', 1)100 tryCompare(mainViewLoader.item.currentStack, 'depth', 1)
62101
63 mainViewLoader.item.telepathyReady = true102 mainViewLoader.item.telepathyReady = true
64 tryCompare(mainViewLoader.item.currentStack.currentPage, 'title', i18n.tr('No network'))103 greeter.greeterActive = false
104 tryCompare(mainViewLoader.item.currentStack.currentPage, 'title', i18n.tr('Network name'))
65105
66 // we should still display the title on regular states106 // we should still display the title on regular states
67 mainViewLoader.item.applicationActive = false107 mainViewLoader.item.applicationActive = false
68 tryCompare(mainViewLoader.item.currentStack.currentPage, 'title', i18n.tr('No network'))108 tryCompare(mainViewLoader.item.currentStack.currentPage, 'title', i18n.tr('Network name'))
69109
70 // app must always display "emergency calls" when the greeter is active and app is in foreground110 // app must always display "emergency calls" when the greeter is active and app is in foreground
71 mainViewLoader.item.applicationActive = true111 mainViewLoader.item.applicationActive = true
@@ -75,5 +115,88 @@
75 mainViewLoader.item.applicationActive = false115 mainViewLoader.item.applicationActive = false
76 tryCompare(mainViewLoader.item.currentStack.currentPage, 'title', ' ')116 tryCompare(mainViewLoader.item.currentStack.currentPage, 'title', ' ')
77 }117 }
118
119 function test_dialerPageEmergencyNumbers() {
120 tryCompare(mainViewLoader.item, 'applicationActive', true)
121 tryCompare(mainViewLoader.item.currentStack, 'depth', 1)
122
123 mainViewLoader.item.telepathyReady = true
124 mainViewLoader.item.accountReady = true
125 greeter.greeterActive = false
126 mainViewLoader.item.switchToKeypadView()
127
128 var dialerPage = mainViewLoader.item.currentStack.currentPage
129 var keypadEntry = findChild(mainViewLoader, "keypadEntry")
130 var callButton = findChild(mainViewLoader, "callButton")
131
132 // regular number when connected
133 testAccount.connected = true
134 keypadEntry.value = "123"
135 callButton.clicked()
136 compare(callSpy.count, 1)
137 callSpy.clear()
138 mainViewLoader.item.switchToKeypadView()
139
140 // regular number when disconnected
141 testAccount.connected = false
142 keypadEntry.value = "123"
143 callButton.clicked()
144 compare(callSpy.count, 0)
145 callSpy.clear()
146 mainViewLoader.item.switchToKeypadView()
147
148 // regular number in greeter mode
149 testAccount.connected = true
150 greeter.greeterActive = true
151 keypadEntry.value = "123"
152 callButton.clicked()
153 compare(callSpy.count, 0)
154 callSpy.clear()
155 mainViewLoader.item.switchToKeypadView()
156
157 // emergency number in greeter mode when connected
158 testAccount.connected = true
159 greeter.greeterActive = true
160 keypadEntry.value = "444"
161 callButton.clicked()
162 compare(callSpy.count, 1)
163 callSpy.clear()
164 mainViewLoader.item.switchToKeypadView()
165
166 // emergency number in greeter mode when disconnected
167 testAccount.connected = false
168 greeter.greeterActive = true
169 keypadEntry.value = "444"
170 callButton.clicked()
171 compare(callSpy.count, 1)
172 callSpy.clear()
173 mainViewLoader.item.switchToKeypadView()
174
175 // emergency number in flight mode
176 testAccount.connected = false
177 telepathyHelper.emergencyCallsAvailable = false
178 telepathyHelper.flightMode = true
179 greeter.greeterActive = false
180 keypadEntry.value = "444"
181 callButton.clicked()
182 telepathyHelper.emergencyCallsAvailable = true
183 wait(15000)
184 compare(callSpy.count, 1)
185 callSpy.clear()
186 mainViewLoader.item.switchToKeypadView()
187
188 // emergency number in flight mode and greeter mode
189 testAccount.connected = false
190 telepathyHelper.emergencyCallsAvailable = false
191 telepathyHelper.flightMode = true
192 greeter.greeterActive = true
193 keypadEntry.value = "444"
194 callButton.clicked()
195 telepathyHelper.emergencyCallsAvailable = true
196 wait(15000)
197 compare(callSpy.count, 1)
198 callSpy.clear()
199 mainViewLoader.item.switchToKeypadView()
200 }
78 }201 }
79}202}

Subscribers

People subscribed via source and target branches