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
1=== modified file 'src/qml/LiveCallPage/LiveCall.qml'
2--- src/qml/LiveCallPage/LiveCall.qml 2015-04-15 13:39:45 +0000
3+++ src/qml/LiveCallPage/LiveCall.qml 2015-07-16 21:47:45 +0000
4@@ -290,7 +290,7 @@
5 interval: 1000
6 repeat: false
7 running: false
8- onTriggered: mainView.removeLiveCallView()
9+ onTriggered: mainView.switchToKeypadView()
10 }
11
12 Timer {
13@@ -301,8 +301,9 @@
14 onTriggered: {
15 if (!callManager.hasCalls) {
16 if (!mainView.greeterMode) {
17- mainView.removeLiveCallView();
18+ mainView.switchToKeypadView();
19 }
20+
21 // TODO: we can't be sure that the currentPage is a DialerPage instance
22 if (pageStackNormalMode.currentPage.dialNumber) {
23 pageStackNormalMode.currentPage.dialNumber = pendingNumberToDial;
24
25=== modified file 'tests/autopilot/dialer_app/__init__.py'
26--- tests/autopilot/dialer_app/__init__.py 2015-05-14 21:38:07 +0000
27+++ tests/autopilot/dialer_app/__init__.py 2015-07-16 21:47:45 +0000
28@@ -102,6 +102,9 @@
29 """Return the swap calls button"""
30 return self._get_call_hold_button()
31
32+ def _get_new_call_button(self):
33+ return self.wait_select_single(objectName='newCallButton')
34+
35 def get_multi_call_display(self):
36 """Return the multi call display panel"""
37 return self.wait_select_single(objectName='multiCallDisplay')
38@@ -123,6 +126,10 @@
39 """Click the swap calls button"""
40 return self._click_button(self._get_swap_calls_button())
41
42+ def click_new_call_button(self):
43+ """Click the new call button"""
44+ return self._click_button(self._get_new_call_button())
45+
46
47 class PageWithBottomEdge(MainView):
48
49
50=== modified file 'tests/autopilot/dialer_app/helpers.py'
51--- tests/autopilot/dialer_app/helpers.py 2015-04-27 22:15:19 +0000
52+++ tests/autopilot/dialer_app/helpers.py 2015-07-16 21:47:45 +0000
53@@ -41,30 +41,41 @@
54 raise RuntimeError('timed out waiting for incoming phonesim call')
55
56
57-def invoke_incoming_call(caller):
58- """Receive an incoming call from the given caller
59-
60- :parameter caller: the phone number calling
61- """
62-
63+def run_script(script):
64 # prepare and send a Qt GUI script to phonesim, over its private D-BUS
65 # set up by ofono-phonesim-autostart
66 script_dir = tempfile.mkdtemp(prefix="phonesim_script")
67 os.chmod(script_dir, 0o755)
68- with open(os.path.join(script_dir, "call.js"), "w") as f:
69- f.write("""tabCall.gbIncomingCall.leCaller.text = "%s";
70-tabCall.gbIncomingCall.pbIncomingCall.click();
71-""" % (caller))
72+ with open(os.path.join(script_dir, "script.js"), "w") as f:
73+ f.write(script)
74
75 with open("/run/lock/ofono-phonesim-dbus.address") as f:
76 phonesim_bus = f.read().strip()
77 bus = dbus.bus.BusConnection(phonesim_bus)
78 script_proxy = bus.get_object("org.ofono.phonesim", "/")
79 script_proxy.SetPath(script_dir)
80- script_proxy.Run("call.js")
81+ script_proxy.Run("script.js")
82 shutil.rmtree(script_dir)
83
84
85+def invoke_incoming_call(caller):
86+ """Receive an incoming call from the given caller
87+
88+ :parameter caller: the phone number calling
89+ """
90+
91+ run_script("""tabCall.gbIncomingCall.leCaller.text = "%s";
92+tabCall.gbIncomingCall.pbIncomingCall.click();
93+""" % (caller))
94+
95+
96+def hangup_call():
97+ """Hangup an existing call. This only works when there is only one call"""
98+
99+ run_script("""tabCall.twCallMgt.selectColumn(0);
100+tabCall.pbHangup.click();""")
101+
102+
103 def accept_incoming_call():
104 """Accept an existing incoming call"""
105 subprocess.check_call(
106
107=== modified file 'tests/autopilot/dialer_app/tests/test_calls.py'
108--- tests/autopilot/dialer_app/tests/test_calls.py 2015-04-27 22:15:19 +0000
109+++ tests/autopilot/dialer_app/tests/test_calls.py 2015-07-16 21:47:45 +0000
110@@ -36,6 +36,10 @@
111 self.useFixture(phonesim_modem)
112 notification_mock = fixture_setup.MockNotificationSystem()
113 self.useFixture(notification_mock)
114+ memory_backend = fixture_setup.UseMemoryContactBackend()
115+ self.useFixture(memory_backend)
116+ preload_data = fixture_setup.PreloadVcards()
117+ self.useFixture(preload_data)
118 super().setUp()
119
120 def tearDown(self):
121@@ -172,3 +176,31 @@
122 self.assertThat(
123 self.main_view.dialer_page.dialNumber,
124 Eventually(Equals(formattedNumber2)))
125+
126+ def test_call_ending_goes_to_dialpad(self):
127+ """Make sure that when a call ends, the app goes back to dialpad"""
128+ number = "1234567"
129+ helpers.invoke_incoming_call(number)
130+
131+ # wait for incoming call, accept; it would be nicer to fake-click the
132+ # popup notification, but as this isn't generated by dialer-app it
133+ # isn't exposed to autopilot
134+ helpers.wait_for_incoming_call()
135+ time.sleep(1) # let's hear the ringing sound for a second :-)
136+ helpers.accept_incoming_call()
137+
138+ # call back is from that number
139+ self.assertThat(
140+ self.main_view.live_call_page.caller, Eventually(Equals(number)))
141+
142+ # now enter the contacts page and select the first contact
143+ self.main_view.live_call_page.click_new_call_button()
144+ self.main_view.contacts_page.open_contact(0)
145+
146+ # at this point we have a pagestack full of pages, so hanging up the
147+ # call needs to clear that up
148+ helpers.hangup_call()
149+
150+ # check that the dialpad view is there
151+ self.assertThat(self.main_view.dialer_page.active,
152+ Eventually(Equals(True)))

Subscribers

People subscribed via source and target branches