Merge lp:~martin-borho/ubuntu-weather-app/searchinput into lp:ubuntu-weather-app/obsolete.trunk

Proposed by Martin Borho
Status: Merged
Approved by: Raúl Yeguas
Approved revision: 109
Merged at revision: 110
Proposed branch: lp:~martin-borho/ubuntu-weather-app/searchinput
Merge into: lp:ubuntu-weather-app/obsolete.trunk
Diff against target: 549 lines (+412/-36)
4 files modified
components/AddLocationSheet.qml (+115/-29)
resources/images/search.svg (+153/-0)
resources/images/search_item@8.svg (+105/-0)
tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py (+39/-7)
To merge this branch: bzr merge lp:~martin-borho/ubuntu-weather-app/searchinput
Reviewer Review Type Date Requested Status
Raúl Yeguas Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+184780@code.launchpad.net

Commit message

Improvements to the "Add city" sheet, predefined list of cities added

Description of the change

* added alphabetical list of (preliminary) cities to choose from when opening the "Add city" sheet
* design now more in line with the visual design in "Add city" sheet
* updated search box design
* hide OSK after search was send

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
Raúl Yeguas (neokore) wrote :

Good work again, Martin.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'components/AddLocationSheet.qml'
2--- components/AddLocationSheet.qml 2013-08-09 10:48:17 +0000
3+++ components/AddLocationSheet.qml 2013-09-10 13:41:33 +0000
4@@ -30,9 +30,39 @@
5 contentsHeight: parent.height
6 doneButton: false
7
8+ Component.onCompleted: {
9+ locationsRemoved.clear()
10+ // TODO final cities list
11+ var preDefined = [
12+ {"coord":{"lon":116.397232,"lat":39.907501},"service_id":1816670,"name":"Beijing","country":"CN","service":"openweathermap"},
13+ {"coord":{"lon":-58.377232,"lat":-34.613152},"service_id":3435910,"name":"Buenos Aires","country":"AR","service":"openweathermap"},
14+ {"coord":{"lon":31.24967,"lat":30.06263},"service_id":360630,"name":"Cairo","country":"EG","service":"openweathermap"},
15+ {"coord":{"lon":18.422,"lat":-33.9191},"service_id":3369157,"name":"Cape Town","country":"South Africa","service":"openweathermap"},
16+ {"coord":{"lon":10,"lat":53.549999},"service_id":2911298,"name":"Hamburg","country":"DE","service":"openweathermap"},
17+ {"coord":{"lon":73.043289,"lat":33.721481},"service_id":1176615,"name":"Islamabad","country":"PK","service":"openweathermap"},
18+ {"coord":{"lon":-0.12574,"lat":51.50853},"service_id":2643743,"name":"London","country":"GB","service":"openweathermap"},
19+ {"coord":{"lon":-118.243683,"lat":34.052231},"service_id":5368361,"name":"Los Angeles","country":"US","service":"openweathermap"},
20+ {"coord":{"lon":-73.587807,"lat":45.508839},"service_id":6077243,"name":"Montreal","country":"CA","service":"openweathermap"},
21+ {"coord":{"lon":-99.127663,"lat":19.428471},"service_id":3530597,"name":"Mexico City","country":"MX","service":"openweathermap"},
22+ {"coord":{"lon":37.615001678467,"lat":55.756999969482},"service_id":524901,"name":"Moscow","country":"Russia","service":"openweathermap"},
23+ {"coord":{"lon":72.847939,"lat":19.01441},"service_id":1275339,"name":"Mumbai","country":"IN","service":"openweathermap"},
24+ {"coord":{"lon":36.816669,"lat":-1.28333},"service_id":184745,"name":"Nairobi","country":"KE","service":"openweathermap"},
25+ {"coord":{"lon":-74.005966,"lat":40.714272},"service_id":5128581,"name":"New York","country":"US","service":"openweathermap"},
26+ {"coord":{"lon":77.23114,"lat":28.61282},"service_id":1261481,"name":"New Delhi","country":"IN","service":"openweathermap"},
27+ {"coord":{"lon":-122.419418,"lat":37.774929},"service_id":5391959,"name":"San Francisco","country":"US","service":"openweathermap"},
28+ {"coord":{"lon":121.458061,"lat":31.222219},"service_id":1796236,"name":"Shanghai","country":"CN","service":"openweathermap"},
29+ {"coord":{"lon":103.850067,"lat":1.28967},"service_id":1880252,"name":"Singapore","country":"SG","service":"openweathermap"},
30+ {"coord":{"lon":151.207321,"lat":-33.867851},"service_id":2147714,"name":"Sydney","country":"AU","service":"openweathermap"},
31+ {"coord":{"lon":139.691711,"lat":35.689499},"service_id":1850147,"name":"Tokyo","country":"JP","service":"openweathermap"}
32+ ].forEach(function(loc) {
33+ citiesModel.append(loc)
34+ })
35+ Theme.palette.selected.backgroundText = "#656565" //color: Theme.palette.normal.baseText
36+ }
37+
38 WorkerScript {
39 id: searchWorker
40- source: "./WeatherApi.js"
41+ source: Qt.resolvedUrl("./WeatherApi.js")
42 onMessage: {
43 searching.running = false;
44 if(!messageObject.error) {
45@@ -58,6 +88,19 @@
46 listView.visible = true;
47 }
48
49+ function doSearch() {
50+ if(locationString.text !== "") {
51+ cityList.visible = true
52+ locationString.focus = false
53+ citiesModel.clear();
54+ searching.running = true;
55+ searchWorker.sendMessage({
56+ action: "searchByName",
57+ params: {name:locationString.text, units:"metric"}
58+ })
59+ }
60+ }
61+
62 ListModel {
63 id: citiesModel
64 }
65@@ -66,24 +109,49 @@
66 width: parent.width
67 Rectangle {
68 id: searchInput
69- width:parent.width
70- height:units.gu(7)
71+ width:parent.width-units.gu(2)
72+ height:units.gu(5)
73+ anchors.horizontalCenter: parent.horizontalCenter
74 color: "transparent"
75 TextField {
76 id: locationString
77 objectName: "SearchField"
78- width: parent.width-units.gu(2)
79- height:units.gu(5)
80- anchors.centerIn: parent
81+ width: parent.width-units.gu(3)
82+ height:parent.height
83 placeholderText: i18n.tr("Enter a city name")
84 hasClearButton: true
85- onAccepted: {
86- citiesModel.clear();
87- searching.running = true;
88- searchWorker.sendMessage({
89- action: "searchByName",
90- params: {name:locationString.text, units:"metric"}
91- })
92+ onAccepted: doSearch()
93+ primaryItem: Image {
94+ height: parent.height*0.5
95+ width: parent.height*0.5
96+ anchors.verticalCenter: parent.verticalCenter
97+ anchors.verticalCenterOffset: -units.gu(0.2)
98+ source: Qt.resolvedUrl("../resources/images/search.svg")
99+ }
100+ }
101+ Image {
102+ id: searchButton
103+ source: Qt.resolvedUrl("../resources/images/search_item.svg")
104+ height: parent.height
105+ width: parent.height
106+ anchors {
107+ right: parent.right
108+ rightMargin: -units.gu(1)
109+ top: parent.top
110+ }
111+ visible: !searching.running
112+ MouseArea {
113+ anchors.fill: parent
114+ onClicked: doSearch()
115+ }
116+ }
117+ ActivityIndicator {
118+ id: searching
119+ objectName: "SearchingSpinner"
120+ anchors {
121+ verticalCenter: searchButton.verticalCenter
122+ left: searchButton.left
123+ leftMargin: units.gu(1.5)
124 }
125 }
126 }
127@@ -92,27 +160,51 @@
128 id: cityList;
129 anchors.top: searchInput.bottom
130 width: parent.width
131- height: units.gu(52)
132+ height: addLocationSheet.height-searchInput.height-units.gu(9.5)
133 color: "transparent"
134+ visible: true
135 Label {
136 id: noCityError
137 objectName: "noCityError"
138 visible: false
139- anchors.centerIn: parent;
140- font.pixelSize: 18
141- }
142-
143+ anchors.centerIn: parent
144+ fontSize: "small"
145+ }
146+ Component {
147+ id: sectionHeading
148+ ListItem.Header {
149+ Label {
150+ text: section
151+ anchors {
152+ verticalCenter: parent.verticalCenter
153+ left: parent.left
154+ leftMargin: units.gu(1)
155+ }
156+ font.pointSize: FontUtils.sizeToPixels("medium")
157+ }
158+ }
159+ }
160 ListView {
161 id: listView;
162 objectName: "SearchResultList"
163- visible: false
164 clip: true;
165 anchors.fill: parent;
166 model: citiesModel;
167- delegate: ListItem.Standard {
168- objectName: "searchResult" + index
169- text: i18n.tr(name)+((country) ? ', '+i18n.tr(country): '');
170- progression: true;
171+ section.property: "name"
172+ section.criteria: ViewSection.FirstCharacter
173+ section.delegate: sectionHeading;
174+ section.labelPositioning: ViewSection.InlineLabels
175+ delegate: ListItem.Standard {
176+ Label {
177+ objectName: "searchResult" + index
178+ text: i18n.tr(name)+((country) ? ', '+i18n.tr(country): '');
179+ fontSize: "large"
180+ anchors {
181+ left: parent.left
182+ leftMargin: units.gu(2)
183+ verticalCenter: parent.verticalCenter
184+ }
185+ }
186 onClicked: {
187 var location = citiesModel.get(index)
188 locationManagerSheet.addLocation(location)
189@@ -125,12 +217,6 @@
190 align: Qt.AlignTrailing;
191 }
192 }
193- ActivityIndicator{
194- id:searching
195- objectName: "SearchingSpinner"
196- running: false
197- anchors.centerIn: parent
198- }
199 }
200 }
201 }
202
203=== added file 'resources/images/search.svg'
204--- resources/images/search.svg 1970-01-01 00:00:00 +0000
205+++ resources/images/search.svg 2013-09-10 13:41:33 +0000
206@@ -0,0 +1,153 @@
207+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
208+<!-- Created with Inkscape (http://www.inkscape.org/) -->
209+
210+<svg
211+ xmlns:dc="http://purl.org/dc/elements/1.1/"
212+ xmlns:cc="http://creativecommons.org/ns#"
213+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
214+ xmlns:svg="http://www.w3.org/2000/svg"
215+ xmlns="http://www.w3.org/2000/svg"
216+ xmlns:xlink="http://www.w3.org/1999/xlink"
217+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
218+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
219+ width="90"
220+ height="90.000015"
221+ id="svg3133"
222+ version="1.1"
223+ inkscape:version="0.48+devel r12262"
224+ sodipodi:docname="search.svg">
225+ <defs
226+ id="defs3135">
227+ <linearGradient
228+ inkscape:collect="always"
229+ id="linearGradient3803">
230+ <stop
231+ style="stop-color:#e7e5e5;stop-opacity:1;"
232+ offset="0"
233+ id="stop3805" />
234+ <stop
235+ style="stop-color:#e2dfdf;stop-opacity:1"
236+ offset="1"
237+ id="stop3807" />
238+ </linearGradient>
239+ <linearGradient
240+ inkscape:collect="always"
241+ xlink:href="#linearGradient3803"
242+ id="linearGradient3809"
243+ x1="53.012165"
244+ y1="-102.79017"
245+ x2="53.012165"
246+ y2="-66.661224"
247+ gradientUnits="userSpaceOnUse" />
248+ <linearGradient
249+ inkscape:collect="always"
250+ xlink:href="#linearGradient3803"
251+ id="linearGradient3813"
252+ gradientUnits="userSpaceOnUse"
253+ x1="53.012165"
254+ y1="-102.79017"
255+ x2="53.012165"
256+ y2="-66.661224"
257+ gradientTransform="translate(-625,0)" />
258+ </defs>
259+ <sodipodi:namedview
260+ id="base"
261+ pagecolor="#ffffff"
262+ bordercolor="#666666"
263+ borderopacity="1.0"
264+ inkscape:pageopacity="0.0"
265+ inkscape:pageshadow="2"
266+ inkscape:zoom="7.9580781"
267+ inkscape:cx="47.57328"
268+ inkscape:cy="40.531144"
269+ inkscape:document-units="px"
270+ inkscape:current-layer="g3842"
271+ showgrid="true"
272+ inkscape:window-width="1920"
273+ inkscape:window-height="1029"
274+ inkscape:window-x="0"
275+ inkscape:window-y="24"
276+ inkscape:window-maximized="1"
277+ inkscape:snap-grids="true"
278+ inkscape:snap-global="true"
279+ fit-margin-top="0"
280+ fit-margin-left="0"
281+ fit-margin-right="0"
282+ fit-margin-bottom="0"
283+ inkscape:snap-bbox="true"
284+ inkscape:bbox-paths="true"
285+ inkscape:bbox-nodes="true"
286+ inkscape:snap-bbox-edge-midpoints="true"
287+ inkscape:snap-bbox-midpoints="true"
288+ inkscape:object-paths="true"
289+ inkscape:snap-intersection-paths="true"
290+ inkscape:snap-midpoints="true"
291+ inkscape:snap-smooth-nodes="true"
292+ inkscape:object-nodes="true"
293+ inkscape:snap-object-midpoints="true"
294+ inkscape:snap-center="true">
295+ <inkscape:grid
296+ type="xygrid"
297+ id="grid3016"
298+ empspacing="6"
299+ visible="true"
300+ enabled="true"
301+ snapvisiblegridlinesonly="true"
302+ originx="-2.98e-06px"
303+ originy="2.6171874e-06px" />
304+ </sodipodi:namedview>
305+ <metadata
306+ id="metadata3138">
307+ <rdf:RDF>
308+ <cc:Work
309+ rdf:about="">
310+ <dc:format>image/svg+xml</dc:format>
311+ <dc:type
312+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
313+ <dc:title />
314+ </cc:Work>
315+ </rdf:RDF>
316+ </metadata>
317+ <g
318+ inkscape:label="Layer 1"
319+ inkscape:groupmode="layer"
320+ id="layer1"
321+ transform="translate(-2.98e-6,-962.36219)"
322+ style="display:inline">
323+ <g
324+ transform="matrix(0.99934414,0,0,1,-106.92982,549.00002)"
325+ id="g3842"
326+ style="display:inline">
327+ <rect
328+ style="opacity:0.05;color:#000000;fill:none;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
329+ id="rect3844"
330+ width="90.059067"
331+ height="90.000015"
332+ x="107"
333+ y="-503.36218"
334+ transform="scale(1,-1)" />
335+ <path
336+ sodipodi:type="arc"
337+ style="color:#000000;fill:none;stroke:#808080;stroke-width:10.49972248;stroke-miterlimit:4;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
338+ id="path2995"
339+ sodipodi:cx="35.999996"
340+ sodipodi:cy="36.500011"
341+ sodipodi:rx="33"
342+ sodipodi:ry="33.5"
343+ d="m 68.999996,36.500011 a 33,33.5 0 1 1 -65.9999998,0 A 33,33.5 0 1 1 68.999996,36.500011 Z"
344+ transform="matrix(0.86331274,0,0,0.85161915,120.95028,427.27807)" />
345+ <path
346+ style="font-size:xx-small;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#808080;fill-opacity:1;stroke:none;stroke-width:6;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans"
347+ d="m 175.1697,477.23717 -4.25279,4.25 12.00787,12 L 187.17757,489.23717 Z"
348+ id="path3765"
349+ inkscape:connector-curvature="0"
350+ sodipodi:nodetypes="ccccc" />
351+ <path
352+ style="font-size:xx-small;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#808080;fill-opacity:1;stroke:none;stroke-width:11.80387211;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans"
353+ d="m 180.97203,481.40625 c -2.32437,0.012 -4.57033,1.53501 -5.44162,3.68994 -0.87128,2.15492 -0.31496,4.81092 1.34787,6.43506 l 8.79632,8.79991 c 4.02735,4.27401 4.89575,3.69726 8.46955,0.1258 3.57381,-3.57146 4.15747,-4.18909 -0.1258,-8.46955 l -8.79632,-8.79991 C 184.12024,482.05781 182.55003,481.39971 180.97203,481.40625 Z"
354+ id="path3767"
355+ inkscape:connector-curvature="0"
356+ sodipodi:nodetypes="cscczccc" />
357+ </g>
358+ </g>
359+</svg>
360
361=== added file 'resources/images/search_item@8.svg'
362--- resources/images/search_item@8.svg 1970-01-01 00:00:00 +0000
363+++ resources/images/search_item@8.svg 2013-09-10 13:41:33 +0000
364@@ -0,0 +1,105 @@
365+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
366+<!-- Created with Inkscape (http://www.inkscape.org/) -->
367+
368+<svg
369+ xmlns:dc="http://purl.org/dc/elements/1.1/"
370+ xmlns:cc="http://creativecommons.org/ns#"
371+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
372+ xmlns:svg="http://www.w3.org/2000/svg"
373+ xmlns="http://www.w3.org/2000/svg"
374+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
375+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
376+ id="svg2"
377+ version="1.1"
378+ inkscape:version="0.48.4 r9939"
379+ width="40"
380+ height="32"
381+ sodipodi:docname="search_item@8.svg">
382+ <metadata
383+ id="metadata8">
384+ <rdf:RDF>
385+ <cc:Work
386+ rdf:about="">
387+ <dc:format>image/svg+xml</dc:format>
388+ <dc:type
389+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
390+ <dc:title />
391+ </cc:Work>
392+ </rdf:RDF>
393+ </metadata>
394+ <defs
395+ id="defs6">
396+ <linearGradient
397+ id="linearGradient4265">
398+ <stop
399+ style="stop-color:#333333;stop-opacity:1;"
400+ offset="0"
401+ id="stop4267" />
402+ <stop
403+ id="stop4273"
404+ offset="0.5"
405+ style="stop-color:#333333;stop-opacity:0.24855492;" />
406+ <stop
407+ style="stop-color:#333333;stop-opacity:0;"
408+ offset="1"
409+ id="stop4269" />
410+ </linearGradient>
411+ </defs>
412+ <sodipodi:namedview
413+ pagecolor="#ffffff"
414+ bordercolor="#666666"
415+ borderopacity="1"
416+ objecttolerance="10"
417+ gridtolerance="10"
418+ guidetolerance="10"
419+ inkscape:pageopacity="0"
420+ inkscape:pageshadow="2"
421+ inkscape:window-width="1855"
422+ inkscape:window-height="1056"
423+ id="namedview4"
424+ showgrid="false"
425+ showguides="true"
426+ inkscape:guide-bbox="true"
427+ inkscape:zoom="45.254834"
428+ inkscape:cx="12.76993"
429+ inkscape:cy="14.390292"
430+ inkscape:window-x="65"
431+ inkscape:window-y="24"
432+ inkscape:window-maximized="1"
433+ inkscape:current-layer="svg2"
434+ inkscape:snap-bbox="false">
435+ <sodipodi:guide
436+ orientation="0,1"
437+ position="53.5,37.5"
438+ id="guide3007" />
439+ </sodipodi:namedview>
440+ <rect
441+ style="fill:#d05164;fill-opacity:1;stroke:none"
442+ id="rect2982-5"
443+ width="8.0715103"
444+ height="31.993458"
445+ x="1.6336422"
446+ y="0.0012737503"
447+ ry="0" />
448+ <rect
449+ style="fill:#d05164;fill-opacity:1;stroke:none"
450+ id="rect2982"
451+ width="36.046421"
452+ height="31.998526"
453+ x="1.6873904"
454+ y="0.0084995022"
455+ ry="8.0643663" />
456+ <path
457+ id="path2987-23-0-9-7-5"
458+ style="fill:#ffffff;fill-opacity:1;stroke-width:1.5406878;stroke-miterlimit:4;stroke-dasharray:1.5406878, 6.1627512;stroke-dashoffset:0.7703439"
459+ d="m 20.969828,18.441773 c 0,0.888623 -0.720412,1.608978 -1.609035,1.608978 -0.888622,0 -1.608979,-0.720355 -1.608979,-1.608978 0,-0.888624 0.720357,-1.609036 1.608979,-1.609036 0.888623,0 1.609035,0.720412 1.609035,1.609036 z m 2.380792,-3.519786 c 0,0.888623 -0.720356,1.609033 -1.608978,1.609033 -0.888624,0 -1.609036,-0.72041 -1.609036,-1.609033 0,-0.888623 0.720412,-1.60898 1.609036,-1.60898 0.888622,0 1.608978,0.720357 1.608978,1.60898 z m -4.715156,-9.78e-4 c 0,0.888623 -0.720355,1.608978 -1.608978,1.608978 -0.888624,0 -1.608979,-0.720355 -1.608979,-1.608978 0,-0.888623 0.720355,-1.609035 1.608979,-1.609035 0.888623,0 1.608978,0.720412 1.608978,1.609035 z m 7.24089,-3.684795 c 0,0.979475 -0.794056,1.773531 -1.773588,1.773531 -0.979531,0 -1.773586,-0.794056 -1.773586,-1.773531 0,-0.979531 0.794055,-1.7735855 1.773586,-1.7735855 0.979532,0 1.773588,0.7940545 1.773588,1.7735855 z m -4.708009,0.01713 c 0,0.979531 -0.794056,1.773586 -1.773532,1.773586 -0.979531,0 -1.773586,-0.794055 -1.773586,-1.773586 0,-0.979531 0.794055,-1.7735296 1.773586,-1.7735296 0.979476,0 1.773532,0.7939986 1.773532,1.7735296 z m -4.760671,-0.01713 c 0,0.979531 -0.794056,1.773586 -1.773587,1.773586 -0.979531,-1.5e-5 -1.773586,-0.794069 -1.773586,-1.7736 0,-0.979476 0.794055,-1.7735311 1.773586,-1.7735311 0.979531,0 1.773587,0.7940551 1.773587,1.7735311 z"
460+ inkscape:connector-curvature="0" />
461+ <rect
462+ style="fill:#323232;fill-opacity:1;stroke:none"
463+ id="rect4263"
464+ width="1.6118982"
465+ height="32.040779"
466+ x="1.6351844"
467+ y="0.0034180922"
468+ ry="0" />
469+</svg>
470
471=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py'
472--- tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py 2013-08-19 18:24:54 +0000
473+++ tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py 2013-09-10 13:41:33 +0000
474@@ -79,8 +79,8 @@
475 self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120))
476 resultsList = self.main_window.get_object('QQuickListView', 'SearchResultList')
477 self.assertThat(resultsList.visible, Eventually(Equals(True)))
478- self.assertThat(lambda: self.main_window.get_object('Standard', 'searchResult0'), Eventually(Not(Is(None))))
479- firstResult = self.main_window.get_object('Standard', 'searchResult0')
480+ self.assertThat(lambda: self.main_window.get_object('Label', 'searchResult0'), Eventually(Not(Is(None))))
481+ firstResult = self.main_window.get_object('Label', 'searchResult0')
482 self.pointing_device.move_to_object(firstResult)
483 self.pointing_device.click()
484
485@@ -102,6 +102,35 @@
486 tabObjects = self.main_window.get_objects('LocationTab','LocationTab')
487 self.assertEqual(1, len(tabObjects))
488
489+ def test_add_predefined_location(self):
490+ """Adds a location"""
491+ self._open_add_location_page()
492+
493+ resultsList = self.main_window.get_object('QQuickListView', 'SearchResultList')
494+ self.assertThat(resultsList.visible, Eventually(Equals(True)))
495+ self.assertThat(lambda: self.main_window.get_object('Label', 'searchResult4'), Eventually(Not(Is(None))))
496+ firstResult = self.main_window.get_object('Label', 'searchResult4')
497+ self.pointing_device.move_to_object(firstResult)
498+ self.pointing_device.click()
499+
500+ # LocationManagerPage should be visible and "London" added
501+ self.assertThat(lambda: self.main_window.get_object('QQuickListView', 'LocationList'), Eventually(Not(Is(None))))
502+ locationList = self.main_window.get_object('QQuickListView', 'LocationList')
503+ self.assertThat(lambda: self.main_window.get_object('Standard', 'existingLocation0'), Eventually(Not(Is(None))))
504+ addedItem = self.main_window.get_object('Standard', "existingLocation0")
505+ self.assertThat(addedItem.text, Eventually(Equals("Hamburg")))
506+ self._click_sheet_confirm()
507+
508+ # back to locations, wait till data is loaded
509+ load_indicator = self.main_window.get_object('ActivityIndicator', 'LoadingSpinner')
510+ self.assertThat(load_indicator.running, Eventually(Equals(False)))
511+
512+ # only location is there
513+ loadingPage = self.main_window.get_object("Tabs", "rootTabs")
514+ self.assertThat(loadingPage.visible, Eventually(Equals(True)))
515+ tabObjects = self.main_window.get_objects('LocationTab','LocationTab')
516+ self.assertEqual(1, len(tabObjects))
517+
518 def test_search_city(self):
519 """Search for cities"""
520 self._open_add_location_page()
521@@ -116,11 +145,14 @@
522 self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120))
523 resultsList = self.main_window.get_object('QQuickListView', 'SearchResultList')
524 self.assertThat(resultsList.visible, Eventually(Equals(True)))
525- self.assertThat(lambda: self.main_window.get_object('Standard', 'searchResult0'), Eventually(Not(Is(None))))
526- firstResult = self.select_single_retry("Standard", objectName="searchResult0")
527+ self.assertThat(lambda: self.main_window.get_object('Label', 'searchResult0'), Eventually(Not(Is(None))))
528+ firstResult = self.select_single_retry("Label", objectName="searchResult0")
529 self.assertThat(firstResult.text, Eventually(Equals("London, GB")))
530
531- # clear search field and do another search
532+ # regain focus, clear search field and do another search
533+ self.assertThat(lambda: self.main_window.get_object('TextField', 'SearchField'), Eventually(Not(Is(None))))
534+ searchField = self.main_window.get_object("TextField", "SearchField")
535+ self.pointing_device.click_object(searchField)
536 self.assertThat(lambda: self.main_window.select_single('AbstractButton'), Eventually(Not(Is(None))))
537 clear_button = searchField.select_single("AbstractButton")
538 self.pointing_device.click_object(clear_button)
539@@ -132,8 +164,8 @@
540 load_indicator = self.main_window.get_object('ActivityIndicator', 'SearchingSpinner')
541 self.assertThat(load_indicator.running, Eventually(Equals(False), timeout=120))
542 self.assertThat(resultsList.visible, Eventually(Equals(True)))
543- self.assertThat(lambda: self.main_window.get_object('Standard', 'searchResult0'), Eventually(Not(Is(None))))
544- firstResult = self.select_single_retry("Standard", objectName="searchResult0")
545+ self.assertThat(lambda: self.main_window.get_object('Label', 'searchResult0'), Eventually(Not(Is(None))))
546+ firstResult = self.select_single_retry("Label", objectName="searchResult0")
547 self.assertThat(firstResult.text, Eventually(Equals("Hamburg, DE")))
548
549 def test_cancel_adding_location(self):

Subscribers

People subscribed via source and target branches