Merge lp:~ahayzen/ubuntu-weather-app/fix-1496422-1478255-today-extra-info into lp:ubuntu-weather-app

Proposed by Andrew Hayzen
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
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

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: Approve (continuous-integration)
Revision history for this message
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.

Revision history for this message
Victor Thompson (vthompson) wrote :

One additional functional deviation is that when you change views the delegate doesn't auto-collapse as the others do.

Revision history for this message
Victor Thompson (vthompson) :
review: Needs Fixing
Revision history for this message
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/victor/Development/fix-1496422-1478255-today-extra-info/tests/autopilot/ubuntu_weather_app/tests/test_home_page.py", line 77, in test_show_today_details
    home_temp_info.height.wait_for(home_temp_info.expandedHeight)
  File "/usr/lib/python3/dist-packages/autopilot/introspection/types.py", line 180, in wait_for
    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)

review: Needs Fixing
129. By Andrew Hayzen

* Collapse the HomeTempInfo expandable correctly

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
130. By Andrew Hayzen

* Merge of trunk

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

* Merge of trunk

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

I have a few inline comments. I will test tonight.

review: Needs Fixing
132. By Andrew Hayzen

* Fixes for code commentary

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

The OWM provider is down again. I can't adequately test unless it is working.

Revision history for this message
Victor Thompson (vthompson) wrote :

Correction, it appears as though we need to file for an API key (APPID).

Revision history for this message
Andrew Hayzen (ahayzen) wrote :

Yup, appears so as stated in the link [0] you sent to me :-/

0 - http://openweathermap.org/faq#error401

133. By Andrew Hayzen

* Merge of trunk

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
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?

review: Needs Fixing
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

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
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

Revision history for this message
Victor Thompson (vthompson) wrote :

lgtm!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'app/components/DayDelegateExtraInfo.qml'
--- app/components/DayDelegateExtraInfo.qml 2015-09-04 21:36:50 +0000
+++ app/components/DayDelegateExtraInfo.qml 2015-10-15 14:18:21 +0000
@@ -44,6 +44,7 @@
44 horizontalAlignment: Text.AlignHCenter44 horizontalAlignment: Text.AlignHCenter
45 text: modelData.condition45 text: modelData.condition
46 width: parent.width46 width: parent.width
47 visible: text !== ""
47 }48 }
4849
49 ForecastDetailsDelegate {50 ForecastDetailsDelegate {
5051
=== modified file 'app/components/HomeTempInfo.qml'
--- app/components/HomeTempInfo.qml 2015-08-23 18:03:23 +0000
+++ app/components/HomeTempInfo.qml 2015-10-15 14:18:21 +0000
@@ -19,56 +19,181 @@
19import QtQuick 2.419import QtQuick 2.4
20import Ubuntu.Components 1.220import Ubuntu.Components 1.2
2121
2222Item {
23Column {23 id: homeTempInfoItem
24 anchors {24 anchors {
25 left: parent.left25 left: parent.left
26 right: parent.right26 right: parent.right
27 }27 }
28 spacing: units.gu(1)28 clip: true
2929 height: collapsedHeight
30 property alias description: descriptionLabel.text30 objectName: "homeTempInfo"
31 property alias high: highLabel.text31 state: "normal"
32 property alias low: lowLabel.text32 states: [
33 State {
34 name: "normal"
35 PropertyChanges {
36 target: homeTempInfoItem
37 height: collapsedHeight
38 }
39 PropertyChanges {
40 target: expandedInfo
41 opacity: 0
42 }
43 },
44 State {
45 name: "expanded"
46 PropertyChanges {
47 target: homeTempInfoItem
48 height: expandedHeight
49 }
50 PropertyChanges {
51 target: expandedInfo
52 opacity: 1
53 }
54 }
55 ]
56 transitions: [
57 Transition {
58 from: "normal"
59 to: "expanded"
60 SequentialAnimation {
61 ScriptAction {
62 script: expandedInfo.active = true
63 }
64 NumberAnimation {
65 easing.type: Easing.InOutQuad
66 properties: "height,opacity"
67 }
68 }
69 },
70 Transition {
71 from: "expanded"
72 to: "normal"
73 SequentialAnimation {
74 NumberAnimation {
75 easing.type: Easing.InOutQuad
76 properties: "height,opacity"
77 }
78 ScriptAction {
79 script: expandedInfo.active = false
80 }
81 }
82 }
83 ]
84
85 property int collapsedHeight: units.gu(14)
86 property int expandedHeight: collapsedHeight + units.gu(4) + (expandedInfo.item ? expandedInfo.item.height : 0)
87
88 property var modelData
89
33 property alias now: nowLabel.text90 property alias now: nowLabel.text
3491
35 Label {92 Column {
36 font.weight: Font.Light93 id: labelColumn
37 fontSize: "small"94 anchors {
38 text: i18n.tr("Today")95 left: parent.left
39 }96 right: parent.right
4097 }
41 Label {98 spacing: units.gu(1)
42 id: descriptionLabel
43 font.capitalization: Font.Capitalize
44 font.weight: Font.Normal
45 fontSize: "large"
46 }
47
48 Row {
49 spacing: units.gu(2)
5099
51 Label {100 Label {
52 id: nowLabel
53 color: UbuntuColors.orange
54 font.pixelSize: units.gu(8)
55 font.weight: Font.Light101 font.weight: Font.Light
56 height: units.gu(8)102 fontSize: "small"
57 verticalAlignment: Text.AlignBottom // AlignBottom seems to put it at the top?103 text: i18n.tr("Today")
58 }104 }
59105
60 Column {106 Label {
61 Label {107 id: descriptionLabel
62 id: lowLabel108 font.capitalization: Font.Capitalize
63 font.weight: Font.Light109 font.weight: Font.Normal
64 fontSize: "medium"110 fontSize: "large"
65 }111 text: modelData.condition
66112 }
67 Label {113
68 id: highLabel114 Row {
69 font.weight: Font.Light115 spacing: units.gu(2)
70 fontSize: "medium"116
71 }117 Label {
72 }118 id: nowLabel
119 color: UbuntuColors.orange
120 font.pixelSize: units.gu(8)
121 font.weight: Font.Light
122 height: units.gu(8)
123 verticalAlignment: Text.AlignBottom // AlignBottom seems to put it at the top?
124 }
125
126 Column {
127 Label {
128 id: lowLabel
129 font.weight: Font.Light
130 fontSize: "medium"
131 text: modelData.low
132 }
133
134 Label {
135 id: highLabel
136 font.weight: Font.Light
137 fontSize: "medium"
138 text: modelData.high
139 }
140 }
141 }
142 }
143
144 Loader {
145 id: expandedInfo
146 active: false
147 anchors {
148 left: parent.left
149 leftMargin: units.gu(2)
150 right: parent.right
151 rightMargin: units.gu(2)
152 top: labelColumn.bottom
153 topMargin: units.gu(2)
154 }
155 asynchronous: true
156 opacity: 0
157 source: "DayDelegateExtraInfo.qml"
158
159 property var modelData: {
160 var tmp = ({});
161
162 // Remove the condition only for modelData
163 // as it is needed in todayData in the Column above
164 if (todayData) {
165 tmp = todayData;
166 tmp.condition = "";
167 }
168
169 return tmp;
170 }
171 }
172
173 MouseArea {
174 anchors {
175 fill: parent
176 }
177 onClicked: {
178 parent.state = parent.state === "normal" ? "expanded" : "normal"
179 // -2 as this is in header (not a delegate) and needs a fake index
180 locationPages.collapseOtherDelegates(-2)
181 }
182 }
183
184 Behavior on height {
185 NumberAnimation {
186 easing.type: Easing.InOutQuad
187 }
188 }
189
190 Component.onCompleted: {
191 locationPages.collapseOtherDelegates.connect(function(otherIndex) {
192 // -2 as this is in header (not a delegate) and needs a fake index
193 if (homeTempInfoItem && typeof index !== "undefined" && otherIndex !== -2) {
194 state = "normal"
195 }
196 });
73 }197 }
74}198}
199
75200
=== modified file 'app/ui/LocationPane.qml'
--- app/ui/LocationPane.qml 2015-09-05 00:03:33 +0000
+++ app/ui/LocationPane.qml 2015-10-15 14:18:21 +0000
@@ -29,23 +29,21 @@
29 model: ListModel {29 model: ListModel {
3030
31 }31 }
32 objectName: "locationListView"
33 width: weatherApp.width32 width: weatherApp.width
3433
35 /*34 /*
36 Data properties35 Data properties
37 */36 */
38 property string name37 property string name
39 property string conditionText
40 property string currentTemp38 property string currentTemp
41 property string todayMaxTemp
42 property string todayMinTemp
43 property string icon39 property string icon
44 property string iconName40 property string iconName
4541
46 property var hourlyForecastsData42 property var hourlyForecastsData
47 property string hourlyTempUnits43 property string hourlyTempUnits
4844
45 property var todayData
46
49 delegate: DayDelegate {47 delegate: DayDelegate {
50 day: model.day48 day: model.day
51 high: model.high49 high: model.high
@@ -63,7 +61,6 @@
63 margins: units.gu(2)61 margins: units.gu(2)
64 }62 }
65 spacing: units.gu(1)63 spacing: units.gu(1)
66 onHeightChanged: mainPageWeekdayListView.contentY = -height
6764
68 Row { // spacing at top65 Row { // spacing at top
69 height: units.gu(1)66 height: units.gu(1)
@@ -98,9 +95,7 @@
9895
99 HomeTempInfo {96 HomeTempInfo {
100 id: homeTempInfo97 id: homeTempInfo
101 description: conditionText98 modelData: todayData
102 high: mainPageWeekdayListView.todayMaxTemp
103 low: mainPageWeekdayListView.todayMinTemp
104 now: mainPageWeekdayListView.currentTemp99 now: mainPageWeekdayListView.currentTemp
105 }100 }
106101
@@ -143,6 +138,25 @@
143 }138 }
144 }139 }
145140
141 function getDayData(data) {
142 var tempUnits = settings.tempScale === "°C" ? "metric" : "imperial"
143
144 return {
145 day: formatTimestamp(data.date, 'dddd'),
146 low: Math.round(data[tempUnits].tempMin).toString() + settings.tempScale,
147 high: (data[tempUnits].tempMax !== undefined) ? Math.round(data[tempUnits].tempMax).toString() + settings.tempScale : "",
148 image: (data.icon !== undefined && iconMap[data.icon] !== undefined) ? iconMap[data.icon] : "",
149 condition: emptyIfUndefined(data.condition),
150 chanceOfRain: emptyIfUndefined(data.propPrecip, "%"),
151 humidity: emptyIfUndefined(data.humidity, "%"),
152 sunrise: data.sunrise || SunCalc.SunCalc.getTimes(getDate(data.date), data.location.coord.lat, data.location.coord.lon).sunrise.toLocaleTimeString(),
153 sunset: data.sunset || SunCalc.SunCalc.getTimes(getDate(data.date), data.location.coord.lat, data.location.coord.lon).sunset.toLocaleTimeString(),
154 uvIndex: emptyIfUndefined(data.uv),
155 wind: data[tempUnits].windSpeed === undefined || data.windDir === undefined
156 ? "" : Math.round(data[tempUnits].windSpeed) + settings.windUnits + " " + data.windDir
157 };
158 }
159
146 function emptyIfUndefined(variable, append) {160 function emptyIfUndefined(variable, append) {
147 if (append === undefined) {161 if (append === undefined) {
148 append = ""162 append = ""
@@ -163,7 +177,6 @@
163 current = data.data[0].current,177 current = data.data[0].current,
164 forecasts = data.data,178 forecasts = data.data,
165 forecastsLength = forecasts.length,179 forecastsLength = forecasts.length,
166 today = forecasts[0],
167 hourlyForecasts = [];180 hourlyForecasts = [];
168181
169 var tempUnits = settings.tempScale === "°C" ? "metric" : "imperial"182 var tempUnits = settings.tempScale === "°C" ? "metric" : "imperial"
@@ -174,12 +187,10 @@
174 // set current temps and condition187 // set current temps and condition
175 iconName = (current.icon) ? current.icon : "";188 iconName = (current.icon) ? current.icon : "";
176 icon = (imageMap[iconName] !== undefined) ? imageMap[iconName] : "";189 icon = (imageMap[iconName] !== undefined) ? imageMap[iconName] : "";
177 conditionText = (current.condition !== undefined) ? current.condition : "";
178 todayMaxTemp = (today[tempUnits].tempMax !== undefined) ? Math.round(today[tempUnits].tempMax).toString() + settings.tempScale: "";
179 todayMinTemp = Math.round(today[tempUnits].tempMin).toString() + settings.tempScale;
180 currentTemp = Math.round(current[tempUnits].temp).toString() + String("°");190 currentTemp = Math.round(current[tempUnits].temp).toString() + String("°");
181191
182 // reset days list192 // reset days list
193 // TODO: overwrite and trim to make the refresh smoother?
183 mainPageWeekdayListView.model.clear()194 mainPageWeekdayListView.model.clear()
184195
185 // set daily forecasts196 // set daily forecasts
@@ -189,27 +200,20 @@
189 if(forecasts[x].hourly !== undefined && forecasts[x].hourly.length > 0) {200 if(forecasts[x].hourly !== undefined && forecasts[x].hourly.length > 0) {
190 hourlyForecasts = hourlyForecasts.concat(forecasts[x].hourly)201 hourlyForecasts = hourlyForecasts.concat(forecasts[x].hourly)
191 }202 }
192 if(x === 0) {203
193 // skip todays daydata204 // Copy the coords of the location
194 continue;205 // so that sun{rise,set} work with OWM
195 }206 forecasts[x].location = {
196207 coord: data.location.coord,
197 // set daydata208 };
198 var dayData = {209
199 day: formatTimestamp(forecasts[x].date, 'dddd'),210 if (x === 0) {
200 low: Math.round(forecasts[x][tempUnits].tempMin).toString() + settings.tempScale,211 // store today's data for later use
201 high: (forecasts[x][tempUnits].tempMax !== undefined) ? Math.round(forecasts[x][tempUnits].tempMax).toString() + settings.tempScale : "",212 todayData = getDayData(forecasts[x]);
202 image: (forecasts[x].icon !== undefined && iconMap[forecasts[x].icon] !== undefined) ? iconMap[forecasts[x].icon] : "",213 } else {
203 condition: emptyIfUndefined(forecasts[x].condition),214 // set daydata
204 chanceOfRain: emptyIfUndefined(forecasts[x].propPrecip, "%"),215 mainPageWeekdayListView.model.append(getDayData(forecasts[x]));
205 humidity: emptyIfUndefined(forecasts[x].humidity, "%"),216 }
206 sunrise: forecasts[x].sunrise || SunCalc.SunCalc.getTimes(getDate(forecasts[x].date), data.location.coord.lat, data.location.coord.lon).sunrise.toLocaleTimeString(),
207 sunset: forecasts[x].sunset || SunCalc.SunCalc.getTimes(getDate(forecasts[x].date), data.location.coord.lat, data.location.coord.lon).sunset.toLocaleTimeString(),
208 uvIndex: emptyIfUndefined(forecasts[x].uv),
209 wind: forecasts[x][tempUnits].windSpeed === undefined || forecasts[x].windDir === undefined
210 ? "" : Math.round(forecasts[x][tempUnits].windSpeed) + settings.windUnits + " " + forecasts[x].windDir
211 }
212 mainPageWeekdayListView.model.append(dayData);
213 }217 }
214 }218 }
215219
216220
=== modified file 'debian/changelog'
--- debian/changelog 2015-10-14 15:37:32 +0000
+++ debian/changelog 2015-10-15 14:18:21 +0000
@@ -50,6 +50,8 @@
50 * ListItem transparent and PageWithBottomEdge colour correct so that they don't appear white on the LocationsPage50 * ListItem transparent and PageWithBottomEdge colour correct so that they don't appear white on the LocationsPage
51 * When expanding day delegates ensure that extra info is visible by animating it into view (LP: #1496425)51 * When expanding day delegates ensure that extra info is visible by animating it into view (LP: #1496425)
52 * Add support for OWM API keys (LP: #1505848)52 * Add support for OWM API keys (LP: #1505848)
53 * Add autopilot test for expanding the today info
54 * Implement extra info expandable for today info (LP: #1496422, LP: #1478255)
5355
54 [ Carla Sella ]56 [ Carla Sella ]
55 * Create autopilot test which shows the day delegate (LP: #1452491)57 * Create autopilot test which shows the day delegate (LP: #1452491)
5658
=== modified file 'po/com.ubuntu.weather.pot'
--- po/com.ubuntu.weather.pot 2015-10-14 23:46:06 +0000
+++ po/com.ubuntu.weather.pot 2015-10-15 14:18:21 +0000
@@ -8,7 +8,7 @@
8msgstr ""8msgstr ""
9"Project-Id-Version: ubuntu-weather-app\n"9"Project-Id-Version: ubuntu-weather-app\n"
10"Report-Msgid-Bugs-To: \n"10"Report-Msgid-Bugs-To: \n"
11"POT-Creation-Date: 2015-10-15 00:45+0100\n"11"POT-Creation-Date: 2015-10-15 11:39+0100\n"
12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14"Language-Team: LANGUAGE <LL@li.org>\n"14"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -18,31 +18,31 @@
18"Content-Transfer-Encoding: 8bit\n"18"Content-Transfer-Encoding: 8bit\n"
19"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"19"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
2020
21#: ../app/components/DayDelegateExtraInfo.qml:5121#: ../app/components/DayDelegateExtraInfo.qml:52
22msgid "Chance of rain"22msgid "Chance of rain"
23msgstr ""23msgstr ""
2424
25#: ../app/components/DayDelegateExtraInfo.qml:5825#: ../app/components/DayDelegateExtraInfo.qml:59
26msgid "Winds"26msgid "Winds"
27msgstr ""27msgstr ""
2828
29#: ../app/components/DayDelegateExtraInfo.qml:6729#: ../app/components/DayDelegateExtraInfo.qml:68
30msgid "UV Index"30msgid "UV Index"
31msgstr ""31msgstr ""
3232
33#: ../app/components/DayDelegateExtraInfo.qml:7333#: ../app/components/DayDelegateExtraInfo.qml:74
34msgid "Pollen"34msgid "Pollen"
35msgstr ""35msgstr ""
3636
37#: ../app/components/DayDelegateExtraInfo.qml:8037#: ../app/components/DayDelegateExtraInfo.qml:81
38msgid "Humidity"38msgid "Humidity"
39msgstr ""39msgstr ""
4040
41#: ../app/components/DayDelegateExtraInfo.qml:8741#: ../app/components/DayDelegateExtraInfo.qml:88
42msgid "Sunrise"42msgid "Sunrise"
43msgstr ""43msgstr ""
4444
45#: ../app/components/DayDelegateExtraInfo.qml:9445#: ../app/components/DayDelegateExtraInfo.qml:95
46msgid "Sunset"46msgid "Sunset"
47msgstr ""47msgstr ""
4848
@@ -58,7 +58,7 @@
58msgid "Manually add a location by swiping up from the bottom of the display"58msgid "Manually add a location by swiping up from the bottom of the display"
59msgstr ""59msgstr ""
6060
61#: ../app/components/HomeTempInfo.qml:3861#: ../app/components/HomeTempInfo.qml:103
62msgid "Today"62msgid "Today"
63msgstr ""63msgstr ""
6464
6565
=== modified file 'tests/autopilot/ubuntu_weather_app/__init__.py'
--- tests/autopilot/ubuntu_weather_app/__init__.py 2015-09-10 16:46:42 +0000
+++ tests/autopilot/ubuntu_weather_app/__init__.py 2015-10-15 14:18:21 +0000
@@ -8,7 +8,8 @@
8"""ubuntu-weather-app tests and emulators - top level package."""8"""ubuntu-weather-app tests and emulators - top level package."""
9from autopilot.introspection import dbus9from autopilot.introspection import dbus
10import logging10import logging
11from ubuntuuitoolkit import MainView, UbuntuUIToolkitCustomProxyObjectBase11from ubuntuuitoolkit import (MainView, QQuickListView,
12 UbuntuUIToolkitCustomProxyObjectBase)
1213
13logger = logging.getLogger(__name__)14logger = logging.getLogger(__name__)
1415
@@ -196,20 +197,37 @@
196 return self.get_location_pane(self.get_selected_location_index())197 return self.get_location_pane(self.get_selected_location_index())
197198
198199
199class LocationPane(UbuntuUIToolkitCustomProxyObjectBase):200class HomeTempInfo(UbuntuUIToolkitCustomProxyObjectBase):
201 pass
202
203
204class LocationPane(QQuickListView):
200 @click_object205 @click_object
201 def click_day_delegate(self, day):206 def click_day_delegate(self, day):
202 return self.get_day_delegate(day)207 return self.get_day_delegate(day)
203208
204 @click_object209 @click_object
210 def click_home_temp_info(self):
211 return self.get_home_temp_info()
212
213 @click_object
205 def click_settings_button(self):214 def click_settings_button(self):
215 self.swipe_to_top() # ensure at the top of the flickable
216
217 return self.get_settings_button()
218
219 def get_day_delegate(self, day):
220 return self.wait_select_single(
221 "DayDelegate", objectName="dayDelegate" + str(day))
222
223 def get_home_temp_info(self):
224 return self.wait_select_single(
225 "HomeTempInfo", objectName="homeTempInfo")
226
227 def get_settings_button(self):
206 return self.select_single(228 return self.select_single(
207 "AbstractButton", objectName="settingsButton")229 "AbstractButton", objectName="settingsButton")
208230
209 def get_day_delegate(self, day):
210 return self.wait_select_single(
211 "DayDelegate", objectName="dayDelegate" + str(day))
212
213231
214class LocationsPage(Page):232class LocationsPage(Page):
215 """Autopilot helper for LocationsPage."""233 """Autopilot helper for LocationsPage."""
216234
=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_home_page.py'
--- tests/autopilot/ubuntu_weather_app/tests/test_home_page.py 2015-09-05 00:03:33 +0000
+++ tests/autopilot/ubuntu_weather_app/tests/test_home_page.py 2015-10-15 14:18:21 +0000
@@ -37,7 +37,7 @@
3737
38 day = 038 day = 0
3939
40 # Get the first day delegate in the selection pane40 # Get the first day delegate in the selected pane
41 location_pane = self.home_page.get_selected_location_pane()41 location_pane = self.home_page.get_selected_location_pane()
42 day_delegate = location_pane.get_day_delegate(day)42 day_delegate = location_pane.get_day_delegate(day)
4343
@@ -56,3 +56,26 @@
56 # Check that the state and height of the delegate have changed56 # Check that the state and height of the delegate have changed
57 self.assertThat(day_delegate.state, Eventually(Equals("expanded")))57 self.assertThat(day_delegate.state, Eventually(Equals("expanded")))
58 self.assertEqual(day_delegate.height, day_delegate.expandedHeight)58 self.assertEqual(day_delegate.height, day_delegate.expandedHeight)
59
60 def test_show_today_details(self):
61 """tests clicking on the today info to expand and contract it"""
62
63 # Get the HomeTempInfo component from the selected pane
64 location_pane = self.home_page.get_selected_location_pane()
65 home_temp_info = location_pane.get_home_temp_info()
66
67 # Check that the extra info is not shown
68 self.assertThat(home_temp_info.state, Eventually(Equals("normal")))
69
70 # Click the HomeTempInfo to show the extra info
71 location_pane.click_home_temp_info()
72
73 # Re-get HomeTempInfo as change in loaders changes tree
74 home_temp_info = location_pane.get_home_temp_info()
75
76 # Wait for the height of the HomeTempInfo to grow
77 home_temp_info.height.wait_for(home_temp_info.expandedHeight)
78
79 # Check that the state and height of the HomeTempInfo have changed
80 self.assertThat(home_temp_info.state, Eventually(Equals("expanded")))
81 self.assertEqual(home_temp_info.height, home_temp_info.expandedHeight)

Subscribers

People subscribed via source and target branches

to all changes: