Merge lp:~nik90/ubuntu-clock-app/focus-textfields-automatically into lp:ubuntu-clock-app

Proposed by Nekhelesh Ramananthan
Status: Merged
Approved by: Nekhelesh Ramananthan
Approved revision: 119
Merged at revision: 115
Proposed branch: lp:~nik90/ubuntu-clock-app/focus-textfields-automatically
Merge into: lp:ubuntu-clock-app
Diff against target: 154 lines (+30/-18)
5 files modified
app/alarm/AlarmLabel.qml (+4/-0)
app/worldclock/WorldCityList.qml (+2/-1)
debian/changelog (+1/-0)
tests/unit/tst_alarmLabel.qml (+12/-7)
tests/unit/tst_alarmRepeat.qml (+11/-10)
To merge this branch: bzr merge lp:~nik90/ubuntu-clock-app/focus-textfields-automatically
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Leo Arias (community) Approve
Review via email: mp+235403@code.launchpad.net

Commit message

Focus textfields automatically as requested by design.

Description of the change

Focus textfields automatically as requested by design.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Leo Arias (elopio) wrote :

What about adding a QML test here?

114. By Nekhelesh Ramananthan

Added debug to qml test

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
115. By Nekhelesh Ramananthan

Fixed failing qml test

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
116. By Nekhelesh Ramananthan

Added qml test for label focus in alarm label page

Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

@elopio I fixed the failing QML Tests. So from now on all qml tests should pass. I added a qml test to check the default focus in the alarm label page as you requested. I haven't done it for the world city page since that page doesn't have any qml tests yet and as such I need to start from scratch which this MP is not ideal for.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
117. By Nekhelesh Ramananthan

Prepended numbers to test names to ensure the correct order of execution is followed

118. By Nekhelesh Ramananthan

Prepended numbers to test names to ensure the correct order of execution is followed for alarm repeat as well

119. By Nekhelesh Ramananthan

Fixed test names as suggested by leo

Revision history for this message
Leo Arias (elopio) wrote :

Test looks good, and they pass. The code also looks good from my limited QML knowledge, but having a test to confirm the change makes me confident. Thanks nik. Awesome work as always.

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/alarm/AlarmLabel.qml'
2--- app/alarm/AlarmLabel.qml 2014-08-24 12:47:50 +0000
3+++ app/alarm/AlarmLabel.qml 2014-09-23 15:15:38 +0000
4@@ -38,6 +38,10 @@
5 }
6 }
7
8+ Component.onCompleted: {
9+ _labelEntry.forceActiveFocus()
10+ }
11+
12 Column {
13 id: _labelColumn
14
15
16=== modified file 'app/worldclock/WorldCityList.qml'
17--- app/worldclock/WorldCityList.qml 2014-08-24 12:47:50 +0000
18+++ app/worldclock/WorldCityList.qml 2014-09-23 15:15:38 +0000
19@@ -65,6 +65,7 @@
20 iconName: "back"
21 text: i18n.tr("Back")
22 onTriggered: {
23+ cityList.forceActiveFocus()
24 searchField.text = ""
25 worldCityList.state = "default"
26 isOnlineMode = false
27@@ -224,7 +225,7 @@
28 }
29
30 onFlickStarted: {
31- Qt.inputMethod.hide()
32+ forceActiveFocus()
33 }
34
35 anchors.fill: parent
36
37=== modified file 'debian/changelog'
38--- debian/changelog 2014-09-19 21:03:09 +0000
39+++ debian/changelog 2014-09-23 15:15:38 +0000
40@@ -33,6 +33,7 @@
41 * Added alarm snooze settings (LP: #1354400)
42 * Fixed default alarm label not being translatable (LP: #1365012)
43 * Improved multiselect mode behavior and appearance (LP: #1370146)
44+ * Automatically focus textfield (LP: #1372089)
45
46 [Zsombor Egri]
47 * Fixed alarm status toggle being reverted immediately (LP: #1272337)
48
49=== modified file 'tests/unit/tst_alarmLabel.qml'
50--- tests/unit/tst_alarmLabel.qml 2014-08-13 22:18:55 +0000
51+++ tests/unit/tst_alarmLabel.qml 2014-09-23 15:15:38 +0000
52@@ -37,12 +37,6 @@
53 backButton = findChild(header, "customBackButton")
54 }
55
56- function cleanup() {
57- clearTextField(alarmLabel)
58- typeString("Alarm")
59- alarmLabelPage.alarm.message = "Alarm"
60- }
61-
62 function clearTextField(textfield) {
63 // Get textfield focus by clicking once
64 mouseClick(textfield, textfield.width - units.gu(2), textfield.height/2)
65@@ -51,6 +45,14 @@
66 mouseClick(textfield, textfield.width - units.gu(2), textfield.height/2)
67 }
68
69+ /*
70+ Test to check if the alarm label has focus true by default to ensure
71+ that the OSK is shown when the opens the alarm label page.
72+ */
73+ function test_01_alarmLabelHasFocus() {
74+ compare(alarmLabel.focus, true, "Alarm Label does not have focus by default")
75+ }
76+
77 function test_backButtonEnabled_data() {
78 return [
79 {tag: "EmptyAlarmLabel", string: "", enableStatus: false},
80@@ -72,6 +74,8 @@
81
82 compare(alarmLabel.text, data.string, "Alarm label is not what was type in the textfield")
83 compare(backButton.enabled, data.enableStatus, "Back Button enable status is not as expected")
84+
85+ alarmLabel.text = _alarm.message
86 }
87
88 /*
89@@ -79,8 +83,9 @@
90 when the page is loaded.
91 */
92 function test_alarmLabelIsSameAsAlarmMessage() {
93- alarmLabelPage.alarm.message = "Random Alarm Label"
94+ _alarm.message = "Random Alarm Label"
95 compare(alarmLabel.text, "Random Alarm Label", "Alarm label set is not the same as alarm message")
96+ _alarm.reset()
97 }
98 }
99 }
100
101=== modified file 'tests/unit/tst_alarmRepeat.qml'
102--- tests/unit/tst_alarmRepeat.qml 2014-09-02 20:56:44 +0000
103+++ tests/unit/tst_alarmRepeat.qml 2014-09-23 15:15:38 +0000
104@@ -44,6 +44,7 @@
105 function init() {
106 alarmRepeatPageLoader.sourceComponent = alarmRepeatPage
107 alarmRepeatPageLoader.item.visible = true
108+ spy.target = alarmRepeatPageLoader.item.Component
109 header = findChild(mainView, "MainView_Header")
110 backButton = findChild(header, "customBackButton")
111 repeater = findChild(alarmRepeatPageLoader.item, "alarmDays")
112@@ -51,8 +52,17 @@
113
114 function cleanup() {
115 alarmRepeatPageLoader.sourceComponent = undefined
116+ spy.wait()
117+ tryCompare(spy, "count", 1)
118 _alarm.reset()
119 tryCompare(_alarm, "status", Alarm.Ready)
120+ spy.clear()
121+ spy.target = undefined
122+ }
123+
124+ SignalSpy {
125+ id: spy
126+ signalName: "destruction"
127 }
128
129 /*
130@@ -60,7 +70,7 @@
131 default an alarm is an one-time alarm and in the repeat page none of
132 the days must be checked
133 */
134- function test_allSwitchesAreUncheckedByDefault() {
135+ function test_01_allSwitchesAreUncheckedByDefault() {
136 waitForRendering(alarmRepeatPageLoader.item);
137
138 tryCompare(_alarm, "daysOfWeek", 0, 3000, "Alarm days of weeks is not 0 by default")
139@@ -82,15 +92,6 @@
140 function test_alarmTypeSwitch() {
141 waitForRendering(alarmRepeatPageLoader.item);
142
143- // TEST FAILS HERE //
144- // Alarm should be one-time by default. By the test before this
145- // changed the value and the alarm.reset() in the cleanup doesn't
146- // seem to do its job.
147-
148- // test_alarmObjectSetsSwitchStatus() is run before this test. And in
149- // that test I set the alarm type to repeating. However the cleanup
150- // should reset back to one-time when calling the alarm.reset() function.
151-
152 tryCompare(_alarm, "type", Alarm.OneTime, 3000, "Alarm type is not OneTime by default")
153
154 var dayListItem = findChild(alarmRepeatPageLoader.item, "alarmDay"+3)

Subscribers

People subscribed via source and target branches