Merge lp:~boiko/dialer-app/fix_1471306 into lp:dialer-app

Proposed by Gustavo Pichorim Boiko
Status: Merged
Approved by: Tiago Salem Herrmann
Approved revision: 435
Merged at revision: 439
Proposed branch: lp:~boiko/dialer-app/fix_1471306
Merge into: lp:dialer-app
Diff against target: 152 lines (+64/-13)
4 files modified
src/qml/LiveCallPage/LiveCall.qml (+3/-2)
tests/autopilot/dialer_app/__init__.py (+7/-0)
tests/autopilot/dialer_app/helpers.py (+22/-11)
tests/autopilot/dialer_app/tests/test_calls.py (+32/-0)
To merge this branch: bzr merge lp:~boiko/dialer-app/fix_1471306
Reviewer Review Type Date Requested Status
Tiago Salem Herrmann (community) Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+265068@code.launchpad.net

Commit message

Always force dialer-app to go back to the dialpad view when all calls end.

Description of the change

Always force dialer-app to go back to the dialpad view when all calls end.

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

Looks good to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/qml/LiveCallPage/LiveCall.qml'
--- src/qml/LiveCallPage/LiveCall.qml 2015-04-15 13:39:45 +0000
+++ src/qml/LiveCallPage/LiveCall.qml 2015-07-16 21:47:45 +0000
@@ -290,7 +290,7 @@
290 interval: 1000290 interval: 1000
291 repeat: false291 repeat: false
292 running: false292 running: false
293 onTriggered: mainView.removeLiveCallView()293 onTriggered: mainView.switchToKeypadView()
294 }294 }
295 295
296 Timer {296 Timer {
@@ -301,8 +301,9 @@
301 onTriggered: {301 onTriggered: {
302 if (!callManager.hasCalls) {302 if (!callManager.hasCalls) {
303 if (!mainView.greeterMode) {303 if (!mainView.greeterMode) {
304 mainView.removeLiveCallView();304 mainView.switchToKeypadView();
305 }305 }
306
306 // TODO: we can't be sure that the currentPage is a DialerPage instance307 // TODO: we can't be sure that the currentPage is a DialerPage instance
307 if (pageStackNormalMode.currentPage.dialNumber) {308 if (pageStackNormalMode.currentPage.dialNumber) {
308 pageStackNormalMode.currentPage.dialNumber = pendingNumberToDial;309 pageStackNormalMode.currentPage.dialNumber = pendingNumberToDial;
309310
=== modified file 'tests/autopilot/dialer_app/__init__.py'
--- tests/autopilot/dialer_app/__init__.py 2015-05-14 21:38:07 +0000
+++ tests/autopilot/dialer_app/__init__.py 2015-07-16 21:47:45 +0000
@@ -102,6 +102,9 @@
102 """Return the swap calls button"""102 """Return the swap calls button"""
103 return self._get_call_hold_button()103 return self._get_call_hold_button()
104104
105 def _get_new_call_button(self):
106 return self.wait_select_single(objectName='newCallButton')
107
105 def get_multi_call_display(self):108 def get_multi_call_display(self):
106 """Return the multi call display panel"""109 """Return the multi call display panel"""
107 return self.wait_select_single(objectName='multiCallDisplay')110 return self.wait_select_single(objectName='multiCallDisplay')
@@ -123,6 +126,10 @@
123 """Click the swap calls button"""126 """Click the swap calls button"""
124 return self._click_button(self._get_swap_calls_button())127 return self._click_button(self._get_swap_calls_button())
125128
129 def click_new_call_button(self):
130 """Click the new call button"""
131 return self._click_button(self._get_new_call_button())
132
126133
127class PageWithBottomEdge(MainView):134class PageWithBottomEdge(MainView):
128135
129136
=== modified file 'tests/autopilot/dialer_app/helpers.py'
--- tests/autopilot/dialer_app/helpers.py 2015-04-27 22:15:19 +0000
+++ tests/autopilot/dialer_app/helpers.py 2015-07-16 21:47:45 +0000
@@ -41,30 +41,41 @@
41 raise RuntimeError('timed out waiting for incoming phonesim call')41 raise RuntimeError('timed out waiting for incoming phonesim call')
4242
4343
44def invoke_incoming_call(caller):44def run_script(script):
45 """Receive an incoming call from the given caller
46
47 :parameter caller: the phone number calling
48 """
49
50 # prepare and send a Qt GUI script to phonesim, over its private D-BUS45 # prepare and send a Qt GUI script to phonesim, over its private D-BUS
51 # set up by ofono-phonesim-autostart46 # set up by ofono-phonesim-autostart
52 script_dir = tempfile.mkdtemp(prefix="phonesim_script")47 script_dir = tempfile.mkdtemp(prefix="phonesim_script")
53 os.chmod(script_dir, 0o755)48 os.chmod(script_dir, 0o755)
54 with open(os.path.join(script_dir, "call.js"), "w") as f:49 with open(os.path.join(script_dir, "script.js"), "w") as f:
55 f.write("""tabCall.gbIncomingCall.leCaller.text = "%s";50 f.write(script)
56tabCall.gbIncomingCall.pbIncomingCall.click();
57""" % (caller))
5851
59 with open("/run/lock/ofono-phonesim-dbus.address") as f:52 with open("/run/lock/ofono-phonesim-dbus.address") as f:
60 phonesim_bus = f.read().strip()53 phonesim_bus = f.read().strip()
61 bus = dbus.bus.BusConnection(phonesim_bus)54 bus = dbus.bus.BusConnection(phonesim_bus)
62 script_proxy = bus.get_object("org.ofono.phonesim", "/")55 script_proxy = bus.get_object("org.ofono.phonesim", "/")
63 script_proxy.SetPath(script_dir)56 script_proxy.SetPath(script_dir)
64 script_proxy.Run("call.js")57 script_proxy.Run("script.js")
65 shutil.rmtree(script_dir)58 shutil.rmtree(script_dir)
6659
6760
61def invoke_incoming_call(caller):
62 """Receive an incoming call from the given caller
63
64 :parameter caller: the phone number calling
65 """
66
67 run_script("""tabCall.gbIncomingCall.leCaller.text = "%s";
68tabCall.gbIncomingCall.pbIncomingCall.click();
69""" % (caller))
70
71
72def hangup_call():
73 """Hangup an existing call. This only works when there is only one call"""
74
75 run_script("""tabCall.twCallMgt.selectColumn(0);
76tabCall.pbHangup.click();""")
77
78
68def accept_incoming_call():79def accept_incoming_call():
69 """Accept an existing incoming call"""80 """Accept an existing incoming call"""
70 subprocess.check_call(81 subprocess.check_call(
7182
=== modified file 'tests/autopilot/dialer_app/tests/test_calls.py'
--- tests/autopilot/dialer_app/tests/test_calls.py 2015-04-27 22:15:19 +0000
+++ tests/autopilot/dialer_app/tests/test_calls.py 2015-07-16 21:47:45 +0000
@@ -36,6 +36,10 @@
36 self.useFixture(phonesim_modem)36 self.useFixture(phonesim_modem)
37 notification_mock = fixture_setup.MockNotificationSystem()37 notification_mock = fixture_setup.MockNotificationSystem()
38 self.useFixture(notification_mock)38 self.useFixture(notification_mock)
39 memory_backend = fixture_setup.UseMemoryContactBackend()
40 self.useFixture(memory_backend)
41 preload_data = fixture_setup.PreloadVcards()
42 self.useFixture(preload_data)
39 super().setUp()43 super().setUp()
4044
41 def tearDown(self):45 def tearDown(self):
@@ -172,3 +176,31 @@
172 self.assertThat(176 self.assertThat(
173 self.main_view.dialer_page.dialNumber,177 self.main_view.dialer_page.dialNumber,
174 Eventually(Equals(formattedNumber2)))178 Eventually(Equals(formattedNumber2)))
179
180 def test_call_ending_goes_to_dialpad(self):
181 """Make sure that when a call ends, the app goes back to dialpad"""
182 number = "1234567"
183 helpers.invoke_incoming_call(number)
184
185 # wait for incoming call, accept; it would be nicer to fake-click the
186 # popup notification, but as this isn't generated by dialer-app it
187 # isn't exposed to autopilot
188 helpers.wait_for_incoming_call()
189 time.sleep(1) # let's hear the ringing sound for a second :-)
190 helpers.accept_incoming_call()
191
192 # call back is from that number
193 self.assertThat(
194 self.main_view.live_call_page.caller, Eventually(Equals(number)))
195
196 # now enter the contacts page and select the first contact
197 self.main_view.live_call_page.click_new_call_button()
198 self.main_view.contacts_page.open_contact(0)
199
200 # at this point we have a pagestack full of pages, so hanging up the
201 # call needs to clear that up
202 helpers.hangup_call()
203
204 # check that the dialpad view is there
205 self.assertThat(self.main_view.dialer_page.active,
206 Eventually(Equals(True)))

Subscribers

People subscribed via source and target branches