Merge lp:~ahayzen/ubuntu-weather-app/fix-1496422-1478255-today-extra-info into lp:ubuntu-weather-app
- fix-1496422-1478255-today-extra-info
- Merge into reboot
Status: | Merged |
---|---|
Approved by: | Victor Thompson |
Approved revision: | 135 |
Merged at revision: | 138 |
Proposed branch: | lp:~ahayzen/ubuntu-weather-app/fix-1496422-1478255-today-extra-info |
Merge into: | lp:ubuntu-weather-app |
Diff against target: |
549 lines (+264/-91) 7 files modified
app/components/DayDelegateExtraInfo.qml (+1/-0) app/components/HomeTempInfo.qml (+167/-42) app/ui/LocationPane.qml (+37/-33) debian/changelog (+2/-0) po/com.ubuntu.weather.pot (+9/-9) tests/autopilot/ubuntu_weather_app/__init__.py (+24/-6) tests/autopilot/ubuntu_weather_app/tests/test_home_page.py (+24/-1) |
To merge this branch: | bzr merge lp:~ahayzen/ubuntu-weather-app/fix-1496422-1478255-today-extra-info |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Victor Thompson | Approve | ||
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Review via email: mp+272790@code.launchpad.net |
Commit message
* Implement extra info expandable for today info
* Add autopilot test for expanding the today info
Description of the change
* Implement extra info expandable for today info
* Add autopilot test for expanding the today info
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
Victor Thompson (vthompson) wrote : | # |
Four functional comments before I review the code.
1. The existing list items contract when the view changes, we should do the same for the today delegate.
2. Currently you can expand today and a future day. You should only be able to expand one.
3. This goes against the initial design, so perhaps we need to get clarification... but I'd rather we put the descriptive weather text for this view as well.
4. Are the added conditions the current conditions when applicable? For instance is the wind speed the current wind speed? Part of me wants to ask Design to change "Today" to "Now" because these conditions should all be the current conditions, IMO.
Victor Thompson (vthompson) wrote : | # |
One additional functional deviation is that when you change views the delegate doesn't auto-collapse as the others do.
Victor Thompson (vthompson) : | # |
Victor Thompson (vthompson) wrote : | # |
I have a few inline comments. Also, the test being added does not pass.
Traceback (most recent call last):
File "/home/
home_
File "/usr/lib/
failure_msg))
AssertionError: After 10.0 seconds test on HomeTempInfo.height failed: 128 != dbus.Double(240.0, variant_level=1)
Ran 1 test in 13.476s
FAILED (failures=1)
- 129. By Andrew Hayzen
-
* Collapse the HomeTempInfo expandable correctly
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:129
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 130. By Andrew Hayzen
-
* Merge of trunk
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:130
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 131. By Andrew Hayzen
-
* Merge of trunk
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:131
http://
Executed test runs:
SUCCESS: http://
Click here to trigger a rebuild:
http://
Victor Thompson (vthompson) wrote : | # |
I have a few inline comments. I will test tonight.
- 132. By Andrew Hayzen
-
* Fixes for code commentary
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:132
http://
Executed test runs:
SUCCESS: http://
Click here to trigger a rebuild:
http://
Victor Thompson (vthompson) wrote : | # |
The OWM provider is down again. I can't adequately test unless it is working.
Victor Thompson (vthompson) wrote : | # |
Correction, it appears as though we need to file for an API key (APPID).
Andrew Hayzen (ahayzen) wrote : | # |
Yup, appears so as stated in the link [0] you sent to me :-/
- 133. By Andrew Hayzen
-
* Merge of trunk
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:133
http://
Executed test runs:
SUCCESS: http://
Click here to trigger a rebuild:
http://
Victor Thompson (vthompson) wrote : | # |
I'm trying to get my mako device working again--mir appears to be broken. On the desktop at least having the Today expandable "jump to the top" when you expand it or contract it is fairly annoying. Is there a reason we do this?
- 134. By Andrew Hayzen
-
* Fix for autopilot not flicking to top when getting the settings button
- 135. By Andrew Hayzen
-
* Don't scroll when the height of the header changes
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:135
http://
Executed test runs:
SUCCESS: http://
Click here to trigger a rebuild:
http://
Andrew Hayzen (ahayzen) wrote : | # |
All fixed, and autopilot is passing as well, please re-test :-)
Ran 14 tests in 123.433s
OK
I: autopilot tests done
Preview Diff
1 | === modified file 'app/components/DayDelegateExtraInfo.qml' |
2 | --- app/components/DayDelegateExtraInfo.qml 2015-09-04 21:36:50 +0000 |
3 | +++ app/components/DayDelegateExtraInfo.qml 2015-10-15 14:18:21 +0000 |
4 | @@ -44,6 +44,7 @@ |
5 | horizontalAlignment: Text.AlignHCenter |
6 | text: modelData.condition |
7 | width: parent.width |
8 | + visible: text !== "" |
9 | } |
10 | |
11 | ForecastDetailsDelegate { |
12 | |
13 | === modified file 'app/components/HomeTempInfo.qml' |
14 | --- app/components/HomeTempInfo.qml 2015-08-23 18:03:23 +0000 |
15 | +++ app/components/HomeTempInfo.qml 2015-10-15 14:18:21 +0000 |
16 | @@ -19,56 +19,181 @@ |
17 | import QtQuick 2.4 |
18 | import Ubuntu.Components 1.2 |
19 | |
20 | - |
21 | -Column { |
22 | +Item { |
23 | + id: homeTempInfoItem |
24 | anchors { |
25 | left: parent.left |
26 | right: parent.right |
27 | } |
28 | - spacing: units.gu(1) |
29 | - |
30 | - property alias description: descriptionLabel.text |
31 | - property alias high: highLabel.text |
32 | - property alias low: lowLabel.text |
33 | + clip: true |
34 | + height: collapsedHeight |
35 | + objectName: "homeTempInfo" |
36 | + state: "normal" |
37 | + states: [ |
38 | + State { |
39 | + name: "normal" |
40 | + PropertyChanges { |
41 | + target: homeTempInfoItem |
42 | + height: collapsedHeight |
43 | + } |
44 | + PropertyChanges { |
45 | + target: expandedInfo |
46 | + opacity: 0 |
47 | + } |
48 | + }, |
49 | + State { |
50 | + name: "expanded" |
51 | + PropertyChanges { |
52 | + target: homeTempInfoItem |
53 | + height: expandedHeight |
54 | + } |
55 | + PropertyChanges { |
56 | + target: expandedInfo |
57 | + opacity: 1 |
58 | + } |
59 | + } |
60 | + ] |
61 | + transitions: [ |
62 | + Transition { |
63 | + from: "normal" |
64 | + to: "expanded" |
65 | + SequentialAnimation { |
66 | + ScriptAction { |
67 | + script: expandedInfo.active = true |
68 | + } |
69 | + NumberAnimation { |
70 | + easing.type: Easing.InOutQuad |
71 | + properties: "height,opacity" |
72 | + } |
73 | + } |
74 | + }, |
75 | + Transition { |
76 | + from: "expanded" |
77 | + to: "normal" |
78 | + SequentialAnimation { |
79 | + NumberAnimation { |
80 | + easing.type: Easing.InOutQuad |
81 | + properties: "height,opacity" |
82 | + } |
83 | + ScriptAction { |
84 | + script: expandedInfo.active = false |
85 | + } |
86 | + } |
87 | + } |
88 | + ] |
89 | + |
90 | + property int collapsedHeight: units.gu(14) |
91 | + property int expandedHeight: collapsedHeight + units.gu(4) + (expandedInfo.item ? expandedInfo.item.height : 0) |
92 | + |
93 | + property var modelData |
94 | + |
95 | property alias now: nowLabel.text |
96 | |
97 | - Label { |
98 | - font.weight: Font.Light |
99 | - fontSize: "small" |
100 | - text: i18n.tr("Today") |
101 | - } |
102 | - |
103 | - Label { |
104 | - id: descriptionLabel |
105 | - font.capitalization: Font.Capitalize |
106 | - font.weight: Font.Normal |
107 | - fontSize: "large" |
108 | - } |
109 | - |
110 | - Row { |
111 | - spacing: units.gu(2) |
112 | + Column { |
113 | + id: labelColumn |
114 | + anchors { |
115 | + left: parent.left |
116 | + right: parent.right |
117 | + } |
118 | + spacing: units.gu(1) |
119 | |
120 | Label { |
121 | - id: nowLabel |
122 | - color: UbuntuColors.orange |
123 | - font.pixelSize: units.gu(8) |
124 | font.weight: Font.Light |
125 | - height: units.gu(8) |
126 | - verticalAlignment: Text.AlignBottom // AlignBottom seems to put it at the top? |
127 | - } |
128 | - |
129 | - Column { |
130 | - Label { |
131 | - id: lowLabel |
132 | - font.weight: Font.Light |
133 | - fontSize: "medium" |
134 | - } |
135 | - |
136 | - Label { |
137 | - id: highLabel |
138 | - font.weight: Font.Light |
139 | - fontSize: "medium" |
140 | - } |
141 | - } |
142 | + fontSize: "small" |
143 | + text: i18n.tr("Today") |
144 | + } |
145 | + |
146 | + Label { |
147 | + id: descriptionLabel |
148 | + font.capitalization: Font.Capitalize |
149 | + font.weight: Font.Normal |
150 | + fontSize: "large" |
151 | + text: modelData.condition |
152 | + } |
153 | + |
154 | + Row { |
155 | + spacing: units.gu(2) |
156 | + |
157 | + Label { |
158 | + id: nowLabel |
159 | + color: UbuntuColors.orange |
160 | + font.pixelSize: units.gu(8) |
161 | + font.weight: Font.Light |
162 | + height: units.gu(8) |
163 | + verticalAlignment: Text.AlignBottom // AlignBottom seems to put it at the top? |
164 | + } |
165 | + |
166 | + Column { |
167 | + Label { |
168 | + id: lowLabel |
169 | + font.weight: Font.Light |
170 | + fontSize: "medium" |
171 | + text: modelData.low |
172 | + } |
173 | + |
174 | + Label { |
175 | + id: highLabel |
176 | + font.weight: Font.Light |
177 | + fontSize: "medium" |
178 | + text: modelData.high |
179 | + } |
180 | + } |
181 | + } |
182 | + } |
183 | + |
184 | + Loader { |
185 | + id: expandedInfo |
186 | + active: false |
187 | + anchors { |
188 | + left: parent.left |
189 | + leftMargin: units.gu(2) |
190 | + right: parent.right |
191 | + rightMargin: units.gu(2) |
192 | + top: labelColumn.bottom |
193 | + topMargin: units.gu(2) |
194 | + } |
195 | + asynchronous: true |
196 | + opacity: 0 |
197 | + source: "DayDelegateExtraInfo.qml" |
198 | + |
199 | + property var modelData: { |
200 | + var tmp = ({}); |
201 | + |
202 | + // Remove the condition only for modelData |
203 | + // as it is needed in todayData in the Column above |
204 | + if (todayData) { |
205 | + tmp = todayData; |
206 | + tmp.condition = ""; |
207 | + } |
208 | + |
209 | + return tmp; |
210 | + } |
211 | + } |
212 | + |
213 | + MouseArea { |
214 | + anchors { |
215 | + fill: parent |
216 | + } |
217 | + onClicked: { |
218 | + parent.state = parent.state === "normal" ? "expanded" : "normal" |
219 | + // -2 as this is in header (not a delegate) and needs a fake index |
220 | + locationPages.collapseOtherDelegates(-2) |
221 | + } |
222 | + } |
223 | + |
224 | + Behavior on height { |
225 | + NumberAnimation { |
226 | + easing.type: Easing.InOutQuad |
227 | + } |
228 | + } |
229 | + |
230 | + Component.onCompleted: { |
231 | + locationPages.collapseOtherDelegates.connect(function(otherIndex) { |
232 | + // -2 as this is in header (not a delegate) and needs a fake index |
233 | + if (homeTempInfoItem && typeof index !== "undefined" && otherIndex !== -2) { |
234 | + state = "normal" |
235 | + } |
236 | + }); |
237 | } |
238 | } |
239 | + |
240 | |
241 | === modified file 'app/ui/LocationPane.qml' |
242 | --- app/ui/LocationPane.qml 2015-09-05 00:03:33 +0000 |
243 | +++ app/ui/LocationPane.qml 2015-10-15 14:18:21 +0000 |
244 | @@ -29,23 +29,21 @@ |
245 | model: ListModel { |
246 | |
247 | } |
248 | - objectName: "locationListView" |
249 | width: weatherApp.width |
250 | |
251 | /* |
252 | Data properties |
253 | */ |
254 | property string name |
255 | - property string conditionText |
256 | property string currentTemp |
257 | - property string todayMaxTemp |
258 | - property string todayMinTemp |
259 | property string icon |
260 | property string iconName |
261 | |
262 | property var hourlyForecastsData |
263 | property string hourlyTempUnits |
264 | |
265 | + property var todayData |
266 | + |
267 | delegate: DayDelegate { |
268 | day: model.day |
269 | high: model.high |
270 | @@ -63,7 +61,6 @@ |
271 | margins: units.gu(2) |
272 | } |
273 | spacing: units.gu(1) |
274 | - onHeightChanged: mainPageWeekdayListView.contentY = -height |
275 | |
276 | Row { // spacing at top |
277 | height: units.gu(1) |
278 | @@ -98,9 +95,7 @@ |
279 | |
280 | HomeTempInfo { |
281 | id: homeTempInfo |
282 | - description: conditionText |
283 | - high: mainPageWeekdayListView.todayMaxTemp |
284 | - low: mainPageWeekdayListView.todayMinTemp |
285 | + modelData: todayData |
286 | now: mainPageWeekdayListView.currentTemp |
287 | } |
288 | |
289 | @@ -143,6 +138,25 @@ |
290 | } |
291 | } |
292 | |
293 | + function getDayData(data) { |
294 | + var tempUnits = settings.tempScale === "°C" ? "metric" : "imperial" |
295 | + |
296 | + return { |
297 | + day: formatTimestamp(data.date, 'dddd'), |
298 | + low: Math.round(data[tempUnits].tempMin).toString() + settings.tempScale, |
299 | + high: (data[tempUnits].tempMax !== undefined) ? Math.round(data[tempUnits].tempMax).toString() + settings.tempScale : "", |
300 | + image: (data.icon !== undefined && iconMap[data.icon] !== undefined) ? iconMap[data.icon] : "", |
301 | + condition: emptyIfUndefined(data.condition), |
302 | + chanceOfRain: emptyIfUndefined(data.propPrecip, "%"), |
303 | + humidity: emptyIfUndefined(data.humidity, "%"), |
304 | + sunrise: data.sunrise || SunCalc.SunCalc.getTimes(getDate(data.date), data.location.coord.lat, data.location.coord.lon).sunrise.toLocaleTimeString(), |
305 | + sunset: data.sunset || SunCalc.SunCalc.getTimes(getDate(data.date), data.location.coord.lat, data.location.coord.lon).sunset.toLocaleTimeString(), |
306 | + uvIndex: emptyIfUndefined(data.uv), |
307 | + wind: data[tempUnits].windSpeed === undefined || data.windDir === undefined |
308 | + ? "" : Math.round(data[tempUnits].windSpeed) + settings.windUnits + " " + data.windDir |
309 | + }; |
310 | + } |
311 | + |
312 | function emptyIfUndefined(variable, append) { |
313 | if (append === undefined) { |
314 | append = "" |
315 | @@ -163,7 +177,6 @@ |
316 | current = data.data[0].current, |
317 | forecasts = data.data, |
318 | forecastsLength = forecasts.length, |
319 | - today = forecasts[0], |
320 | hourlyForecasts = []; |
321 | |
322 | var tempUnits = settings.tempScale === "°C" ? "metric" : "imperial" |
323 | @@ -174,12 +187,10 @@ |
324 | // set current temps and condition |
325 | iconName = (current.icon) ? current.icon : ""; |
326 | icon = (imageMap[iconName] !== undefined) ? imageMap[iconName] : ""; |
327 | - conditionText = (current.condition !== undefined) ? current.condition : ""; |
328 | - todayMaxTemp = (today[tempUnits].tempMax !== undefined) ? Math.round(today[tempUnits].tempMax).toString() + settings.tempScale: ""; |
329 | - todayMinTemp = Math.round(today[tempUnits].tempMin).toString() + settings.tempScale; |
330 | currentTemp = Math.round(current[tempUnits].temp).toString() + String("°"); |
331 | |
332 | // reset days list |
333 | + // TODO: overwrite and trim to make the refresh smoother? |
334 | mainPageWeekdayListView.model.clear() |
335 | |
336 | // set daily forecasts |
337 | @@ -189,27 +200,20 @@ |
338 | if(forecasts[x].hourly !== undefined && forecasts[x].hourly.length > 0) { |
339 | hourlyForecasts = hourlyForecasts.concat(forecasts[x].hourly) |
340 | } |
341 | - if(x === 0) { |
342 | - // skip todays daydata |
343 | - continue; |
344 | - } |
345 | - |
346 | - // set daydata |
347 | - var dayData = { |
348 | - day: formatTimestamp(forecasts[x].date, 'dddd'), |
349 | - low: Math.round(forecasts[x][tempUnits].tempMin).toString() + settings.tempScale, |
350 | - high: (forecasts[x][tempUnits].tempMax !== undefined) ? Math.round(forecasts[x][tempUnits].tempMax).toString() + settings.tempScale : "", |
351 | - image: (forecasts[x].icon !== undefined && iconMap[forecasts[x].icon] !== undefined) ? iconMap[forecasts[x].icon] : "", |
352 | - condition: emptyIfUndefined(forecasts[x].condition), |
353 | - chanceOfRain: emptyIfUndefined(forecasts[x].propPrecip, "%"), |
354 | - humidity: emptyIfUndefined(forecasts[x].humidity, "%"), |
355 | - sunrise: forecasts[x].sunrise || SunCalc.SunCalc.getTimes(getDate(forecasts[x].date), data.location.coord.lat, data.location.coord.lon).sunrise.toLocaleTimeString(), |
356 | - sunset: forecasts[x].sunset || SunCalc.SunCalc.getTimes(getDate(forecasts[x].date), data.location.coord.lat, data.location.coord.lon).sunset.toLocaleTimeString(), |
357 | - uvIndex: emptyIfUndefined(forecasts[x].uv), |
358 | - wind: forecasts[x][tempUnits].windSpeed === undefined || forecasts[x].windDir === undefined |
359 | - ? "" : Math.round(forecasts[x][tempUnits].windSpeed) + settings.windUnits + " " + forecasts[x].windDir |
360 | - } |
361 | - mainPageWeekdayListView.model.append(dayData); |
362 | + |
363 | + // Copy the coords of the location |
364 | + // so that sun{rise,set} work with OWM |
365 | + forecasts[x].location = { |
366 | + coord: data.location.coord, |
367 | + }; |
368 | + |
369 | + if (x === 0) { |
370 | + // store today's data for later use |
371 | + todayData = getDayData(forecasts[x]); |
372 | + } else { |
373 | + // set daydata |
374 | + mainPageWeekdayListView.model.append(getDayData(forecasts[x])); |
375 | + } |
376 | } |
377 | } |
378 | |
379 | |
380 | === modified file 'debian/changelog' |
381 | --- debian/changelog 2015-10-14 15:37:32 +0000 |
382 | +++ debian/changelog 2015-10-15 14:18:21 +0000 |
383 | @@ -50,6 +50,8 @@ |
384 | * ListItem transparent and PageWithBottomEdge colour correct so that they don't appear white on the LocationsPage |
385 | * When expanding day delegates ensure that extra info is visible by animating it into view (LP: #1496425) |
386 | * Add support for OWM API keys (LP: #1505848) |
387 | + * Add autopilot test for expanding the today info |
388 | + * Implement extra info expandable for today info (LP: #1496422, LP: #1478255) |
389 | |
390 | [ Carla Sella ] |
391 | * Create autopilot test which shows the day delegate (LP: #1452491) |
392 | |
393 | === modified file 'po/com.ubuntu.weather.pot' |
394 | --- po/com.ubuntu.weather.pot 2015-10-14 23:46:06 +0000 |
395 | +++ po/com.ubuntu.weather.pot 2015-10-15 14:18:21 +0000 |
396 | @@ -8,7 +8,7 @@ |
397 | msgstr "" |
398 | "Project-Id-Version: ubuntu-weather-app\n" |
399 | "Report-Msgid-Bugs-To: \n" |
400 | -"POT-Creation-Date: 2015-10-15 00:45+0100\n" |
401 | +"POT-Creation-Date: 2015-10-15 11:39+0100\n" |
402 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
403 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
404 | "Language-Team: LANGUAGE <LL@li.org>\n" |
405 | @@ -18,31 +18,31 @@ |
406 | "Content-Transfer-Encoding: 8bit\n" |
407 | "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" |
408 | |
409 | -#: ../app/components/DayDelegateExtraInfo.qml:51 |
410 | +#: ../app/components/DayDelegateExtraInfo.qml:52 |
411 | msgid "Chance of rain" |
412 | msgstr "" |
413 | |
414 | -#: ../app/components/DayDelegateExtraInfo.qml:58 |
415 | +#: ../app/components/DayDelegateExtraInfo.qml:59 |
416 | msgid "Winds" |
417 | msgstr "" |
418 | |
419 | -#: ../app/components/DayDelegateExtraInfo.qml:67 |
420 | +#: ../app/components/DayDelegateExtraInfo.qml:68 |
421 | msgid "UV Index" |
422 | msgstr "" |
423 | |
424 | -#: ../app/components/DayDelegateExtraInfo.qml:73 |
425 | +#: ../app/components/DayDelegateExtraInfo.qml:74 |
426 | msgid "Pollen" |
427 | msgstr "" |
428 | |
429 | -#: ../app/components/DayDelegateExtraInfo.qml:80 |
430 | +#: ../app/components/DayDelegateExtraInfo.qml:81 |
431 | msgid "Humidity" |
432 | msgstr "" |
433 | |
434 | -#: ../app/components/DayDelegateExtraInfo.qml:87 |
435 | +#: ../app/components/DayDelegateExtraInfo.qml:88 |
436 | msgid "Sunrise" |
437 | msgstr "" |
438 | |
439 | -#: ../app/components/DayDelegateExtraInfo.qml:94 |
440 | +#: ../app/components/DayDelegateExtraInfo.qml:95 |
441 | msgid "Sunset" |
442 | msgstr "" |
443 | |
444 | @@ -58,7 +58,7 @@ |
445 | msgid "Manually add a location by swiping up from the bottom of the display" |
446 | msgstr "" |
447 | |
448 | -#: ../app/components/HomeTempInfo.qml:38 |
449 | +#: ../app/components/HomeTempInfo.qml:103 |
450 | msgid "Today" |
451 | msgstr "" |
452 | |
453 | |
454 | === modified file 'tests/autopilot/ubuntu_weather_app/__init__.py' |
455 | --- tests/autopilot/ubuntu_weather_app/__init__.py 2015-09-10 16:46:42 +0000 |
456 | +++ tests/autopilot/ubuntu_weather_app/__init__.py 2015-10-15 14:18:21 +0000 |
457 | @@ -8,7 +8,8 @@ |
458 | """ubuntu-weather-app tests and emulators - top level package.""" |
459 | from autopilot.introspection import dbus |
460 | import logging |
461 | -from ubuntuuitoolkit import MainView, UbuntuUIToolkitCustomProxyObjectBase |
462 | +from ubuntuuitoolkit import (MainView, QQuickListView, |
463 | + UbuntuUIToolkitCustomProxyObjectBase) |
464 | |
465 | logger = logging.getLogger(__name__) |
466 | |
467 | @@ -196,20 +197,37 @@ |
468 | return self.get_location_pane(self.get_selected_location_index()) |
469 | |
470 | |
471 | -class LocationPane(UbuntuUIToolkitCustomProxyObjectBase): |
472 | +class HomeTempInfo(UbuntuUIToolkitCustomProxyObjectBase): |
473 | + pass |
474 | + |
475 | + |
476 | +class LocationPane(QQuickListView): |
477 | @click_object |
478 | def click_day_delegate(self, day): |
479 | return self.get_day_delegate(day) |
480 | |
481 | @click_object |
482 | + def click_home_temp_info(self): |
483 | + return self.get_home_temp_info() |
484 | + |
485 | + @click_object |
486 | def click_settings_button(self): |
487 | + self.swipe_to_top() # ensure at the top of the flickable |
488 | + |
489 | + return self.get_settings_button() |
490 | + |
491 | + def get_day_delegate(self, day): |
492 | + return self.wait_select_single( |
493 | + "DayDelegate", objectName="dayDelegate" + str(day)) |
494 | + |
495 | + def get_home_temp_info(self): |
496 | + return self.wait_select_single( |
497 | + "HomeTempInfo", objectName="homeTempInfo") |
498 | + |
499 | + def get_settings_button(self): |
500 | return self.select_single( |
501 | "AbstractButton", objectName="settingsButton") |
502 | |
503 | - def get_day_delegate(self, day): |
504 | - return self.wait_select_single( |
505 | - "DayDelegate", objectName="dayDelegate" + str(day)) |
506 | - |
507 | |
508 | class LocationsPage(Page): |
509 | """Autopilot helper for LocationsPage.""" |
510 | |
511 | === modified file 'tests/autopilot/ubuntu_weather_app/tests/test_home_page.py' |
512 | --- tests/autopilot/ubuntu_weather_app/tests/test_home_page.py 2015-09-05 00:03:33 +0000 |
513 | +++ tests/autopilot/ubuntu_weather_app/tests/test_home_page.py 2015-10-15 14:18:21 +0000 |
514 | @@ -37,7 +37,7 @@ |
515 | |
516 | day = 0 |
517 | |
518 | - # Get the first day delegate in the selection pane |
519 | + # Get the first day delegate in the selected pane |
520 | location_pane = self.home_page.get_selected_location_pane() |
521 | day_delegate = location_pane.get_day_delegate(day) |
522 | |
523 | @@ -56,3 +56,26 @@ |
524 | # Check that the state and height of the delegate have changed |
525 | self.assertThat(day_delegate.state, Eventually(Equals("expanded"))) |
526 | self.assertEqual(day_delegate.height, day_delegate.expandedHeight) |
527 | + |
528 | + def test_show_today_details(self): |
529 | + """tests clicking on the today info to expand and contract it""" |
530 | + |
531 | + # Get the HomeTempInfo component from the selected pane |
532 | + location_pane = self.home_page.get_selected_location_pane() |
533 | + home_temp_info = location_pane.get_home_temp_info() |
534 | + |
535 | + # Check that the extra info is not shown |
536 | + self.assertThat(home_temp_info.state, Eventually(Equals("normal"))) |
537 | + |
538 | + # Click the HomeTempInfo to show the extra info |
539 | + location_pane.click_home_temp_info() |
540 | + |
541 | + # Re-get HomeTempInfo as change in loaders changes tree |
542 | + home_temp_info = location_pane.get_home_temp_info() |
543 | + |
544 | + # Wait for the height of the HomeTempInfo to grow |
545 | + home_temp_info.height.wait_for(home_temp_info.expandedHeight) |
546 | + |
547 | + # Check that the state and height of the HomeTempInfo have changed |
548 | + self.assertThat(home_temp_info.state, Eventually(Equals("expanded"))) |
549 | + self.assertEqual(home_temp_info.height, home_temp_info.expandedHeight) |
PASSED: Continuous integration, rev:128 91.189. 93.70:8080/ job/ubuntu- weather- app-reboot- ci/256/ 91.189. 93.70:8080/ job/ubuntu- weather- app-reboot- utopic- amd64-ci/ 226 91.189. 93.70:8080/ job/ubuntu- weather- app-reboot- vivid-amd64- ci/256
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/ubuntu- weather- app-reboot- ci/256/ rebuild
http://