Merge lp:~timo-jyrinki/ubuntu-calendar-app/bug_1293489_mega-merge into lp:ubuntu-calendar-app
- bug_1293489_mega-merge
- Merge into trunk
Status: | Rejected |
---|---|
Rejected by: | Timo Jyrinki |
Proposed branch: | lp:~timo-jyrinki/ubuntu-calendar-app/bug_1293489_mega-merge |
Merge into: | lp:ubuntu-calendar-app |
Diff against target: |
802 lines (+243/-294) 8 files modified
DayView.qml (+4/-3) MonthView.qml (+17/-12) WeekView.qml (+69/-69) YearView.qml (+61/-63) calendar.qml (+46/-101) tests/autopilot/calendar_app/emulators.py (+3/-0) tests/autopilot/calendar_app/tests/__init__.py (+29/-34) tests/autopilot/calendar_app/tests/test_calendar.py (+14/-12) |
To merge this branch: | bzr merge lp:~timo-jyrinki/ubuntu-calendar-app/bug_1293489_mega-merge |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Nicholas Skaggs (community) | Disapprove | ||
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Needs Fixing | |
Review via email: mp+211887@code.launchpad.net |
Commit message
Description of the change
This is a branch of what I'm currently understanding would be needed in case the crash is not able to be fixed otherwise.
Feel free to ignore this branch or do a better one, it's just here to try to clarify the needed branches.
Includes:
- lp:~nskaggs/ubuntu-calendar-app/revert-212
- lp:~nskaggs/ubuntu-calendar-app/standalone-ap-for-1293489 (no changes)
- lp:~chris.gagnon/ubuntu-calendar-app/fix_1293489
- lp:~vthompson/ubuntu-calendar-app/scroll-in-test
The revert-212 includes all of the 2nd one, and is required to fix/workaround the crasher. The last two are actual fixes to bug #1293489, of fix the scroll-in-test needed to accommodate to the fact that revert-212 changed the code beneath.
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
Victor Thompson (vthompson) wrote : | # |
The fix in my branch is made OBE by the changes in lp:~nskaggs/ubuntu-calendar-app/revert-212 to not input text in the people_field. I think it'd be best to add the input of that field back into this branch.
Nicholas Skaggs (nskaggs) wrote : | # |
A mega merge, heh. And yes, Victor I removed the input into the people field. I have a branch I've been working on to refactor the tests here: https:/
It will include the logic to drag the page up so the field can be entered into. For sake of unblocking everything I've removed inputting into this field as the dragging logic introduced other issues inside the test that went beyond the original scope of just getting a working baseline again.
The calendar team has decided to land https:/
Anyways, this merge should no longer be needed.
Unmerged revisions
- 222. By Timo Jyrinki
-
Merge lp:~vthompson/ubuntu-calendar-app/scroll-in-test , resolving conflict (no "#input people" section here)
- 221. By Timo Jyrinki
- 220. By Timo Jyrinki
-
Merge the lp:~nskaggs/ubuntu-calendar-app/standalone-ap-for-1293489 (already included)
Preview Diff
1 | === modified file 'DayView.qml' |
2 | --- DayView.qml 2014-03-06 11:47:25 +0000 |
3 | +++ DayView.qml 2014-03-20 09:41:42 +0000 |
4 | @@ -4,8 +4,7 @@ |
5 | import "dateExt.js" as DateExt |
6 | import "ViewType.js" as ViewType |
7 | |
8 | - |
9 | -Page{ |
10 | +Item{ |
11 | id: root |
12 | objectName: "DayView" |
13 | |
14 | @@ -13,11 +12,13 @@ |
15 | |
16 | Column { |
17 | id: column |
18 | - anchors.fill: parent |
19 | anchors.top: parent.top |
20 | anchors.topMargin: units.gu(1.5) |
21 | + width: parent.width; height: parent.height |
22 | spacing: units.gu(1) |
23 | |
24 | + anchors.fill: parent |
25 | + |
26 | ViewHeader{ |
27 | id: viewHeader |
28 | date: currentDay |
29 | |
30 | === modified file 'MonthView.qml' |
31 | --- MonthView.qml 2014-03-06 14:45:43 +0000 |
32 | +++ MonthView.qml 2014-03-20 09:41:42 +0000 |
33 | @@ -3,18 +3,23 @@ |
34 | import "dateExt.js" as DateExt |
35 | import "colorUtils.js" as Color |
36 | |
37 | -Page{ |
38 | - id: root |
39 | +Page { |
40 | + id: monthViewPage |
41 | + objectName: "MonthView" |
42 | |
43 | property var currentMonth: DateExt.today(); |
44 | + |
45 | signal dateSelected(var date); |
46 | |
47 | - anchors.fill: parent |
48 | - |
49 | PathViewBase{ |
50 | id: monthViewPath |
51 | - objectName: "MonthView" |
52 | - anchors.fill: parent |
53 | + |
54 | + property var startMonth: currentMonth; |
55 | + |
56 | + anchors.top:parent.top |
57 | + |
58 | + width:parent.width |
59 | + height: parent.height |
60 | |
61 | onNextItemHighlighted: { |
62 | nextMonth(); |
63 | @@ -25,11 +30,11 @@ |
64 | } |
65 | |
66 | function nextMonth() { |
67 | - currentMonth = addMonth(root.currentMonth,1); |
68 | + currentMonth = addMonth(currentMonth,1); |
69 | } |
70 | |
71 | function previousMonth(){ |
72 | - currentMonth = addMonth(root.currentMonth,-1); |
73 | + currentMonth = addMonth(currentMonth,-1); |
74 | } |
75 | |
76 | function addMonth(date,month){ |
77 | @@ -49,16 +54,16 @@ |
78 | function getMonthDate() { |
79 | switch( monthViewPath.indexType(index)) { |
80 | case 0: |
81 | - return monthViewPath.addMonth(root.currentMonth,0); |
82 | + return monthViewPath.startMonth; |
83 | case -1: |
84 | - return monthViewPath.addMonth(root.currentMonth,-1); |
85 | + return monthViewPath.addMonth(monthViewPath.startMonth,-1); |
86 | case 1: |
87 | - return monthViewPath.addMonth(root.currentMonth,1); |
88 | + return monthViewPath.addMonth(monthViewPath.startMonth,1); |
89 | } |
90 | } |
91 | |
92 | onDateSelected: { |
93 | - root.dateSelected(date); |
94 | + monthViewPage.dateSelected(date); |
95 | } |
96 | } |
97 | } |
98 | |
99 | === modified file 'WeekView.qml' |
100 | --- WeekView.qml 2014-03-06 11:47:25 +0000 |
101 | +++ WeekView.qml 2014-03-20 09:41:42 +0000 |
102 | @@ -4,82 +4,82 @@ |
103 | import "dateExt.js" as DateExt |
104 | import "ViewType.js" as ViewType |
105 | |
106 | -Page{ |
107 | +Column { |
108 | id: root |
109 | + objectName: "WeekView" |
110 | + |
111 | property var dayStart: new Date(); |
112 | property var firstDay: dayStart.weekStart(Qt.locale().firstDayOfWeek); |
113 | - |
114 | - Column { |
115 | - objectName: "WeekView" |
116 | - |
117 | - anchors.fill: parent |
118 | - anchors.top: parent.top |
119 | - anchors.topMargin: units.gu(1.5) |
120 | - spacing: units.gu(1) |
121 | - |
122 | - ViewHeader{ |
123 | - id: viewHeader |
124 | - date: dayStart |
125 | - } |
126 | - |
127 | - TimeLineHeader{ |
128 | - id: weekHeader |
129 | - objectName: "weekHeader" |
130 | - type: typeWeek |
131 | - date: weekViewPath.weekStart |
132 | - } |
133 | - |
134 | - PathViewBase{ |
135 | - id: weekViewPath |
136 | - |
137 | - property var visibleWeek: root.dayStart.weekStart(Qt.locale().firstDayOfWeek); |
138 | - property var weekStart: weekViewPath.visibleWeek |
139 | + anchors.top: parent.top |
140 | + anchors.topMargin: units.gu(1.5) |
141 | + spacing: units.gu(1) |
142 | + |
143 | + anchors.fill: parent |
144 | + |
145 | + ViewHeader{ |
146 | + id: viewHeader |
147 | + date: dayStart |
148 | + } |
149 | + |
150 | + TimeLineHeader{ |
151 | + id: weekHeader |
152 | + objectName: "weekHeader" |
153 | + type: ViewType.ViewTypeWeek |
154 | + date: weekViewPath.weekStart |
155 | + } |
156 | + |
157 | + PathViewBase{ |
158 | + id: weekViewPath |
159 | + |
160 | + property var visibleWeek: dayStart.weekStart(Qt.locale().firstDayOfWeek); |
161 | + property var weekStart: weekViewPath.visibleWeek |
162 | + |
163 | + width: parent.width |
164 | + height: root.height - weekViewPath.y |
165 | + |
166 | + onNextItemHighlighted: { |
167 | + nextWeek(); |
168 | + weekHeader.incrementCurrentIndex() |
169 | + } |
170 | + |
171 | + onPreviousItemHighlighted: { |
172 | + previousWeek(); |
173 | + weekHeader.decrementCurrentIndex() |
174 | + } |
175 | + |
176 | + function nextWeek() { |
177 | + var weekStartDay = visibleWeek.weekStart(Qt.locale().firstDayOfWeek); |
178 | + dayStart = weekStartDay.addDays(7); |
179 | + } |
180 | + |
181 | + function previousWeek(){ |
182 | + var weekStartDay = visibleWeek.weekStart(Qt.locale().firstDayOfWeek); |
183 | + dayStart = weekStartDay.addDays(-7); |
184 | + } |
185 | + |
186 | + delegate: TimeLineBaseComponent { |
187 | + id: timeLineView |
188 | + |
189 | + type: ViewType.ViewTypeWeek |
190 | |
191 | width: parent.width |
192 | - height: root.height - weekViewPath.y |
193 | - |
194 | - onNextItemHighlighted: { |
195 | - nextWeek(); |
196 | - weekHeader.incrementCurrentIndex() |
197 | - } |
198 | - |
199 | - onPreviousItemHighlighted: { |
200 | - previousWeek(); |
201 | - weekHeader.decrementCurrentIndex() |
202 | - } |
203 | - |
204 | - function nextWeek() { |
205 | - var weekStartDay = visibleWeek.weekStart(Qt.locale().firstDayOfWeek); |
206 | - dayStart = weekStartDay.addDays(7); |
207 | - } |
208 | - |
209 | - function previousWeek(){ |
210 | - var weekStartDay = visibleWeek.weekStart(Qt.locale().firstDayOfWeek); |
211 | - dayStart = weekStartDay.addDays(-7); |
212 | - } |
213 | - |
214 | - delegate: TimeLineBaseComponent { |
215 | - id: timeLineView |
216 | - |
217 | - type: typeWeek |
218 | - |
219 | - width: parent.width |
220 | - height: parent.height |
221 | - startDay: getWeekStart(); |
222 | - |
223 | - function getWeekStart() { |
224 | - switch( weekViewPath.indexType(index)) { |
225 | - case 0: |
226 | - return weekViewPath.weekStart; |
227 | - case -1: |
228 | - var weekStartDay= weekViewPath.weekStart.weekStart(Qt.locale().firstDayOfWeek); |
229 | - return weekStartDay.addDays(-7); |
230 | - case 1: |
231 | - var weekStartDay = weekViewPath.weekStart.weekStart(Qt.locale().firstDayOfWeek); |
232 | - return weekStartDay.addDays(7); |
233 | - } |
234 | + height: parent.height |
235 | + startDay: getWeekStart(); |
236 | + |
237 | + function getWeekStart() { |
238 | + switch( weekViewPath.indexType(index)) { |
239 | + case 0: |
240 | + return weekViewPath.weekStart; |
241 | + case -1: |
242 | + var weekStartDay= weekViewPath.weekStart.weekStart(Qt.locale().firstDayOfWeek); |
243 | + return weekStartDay.addDays(-7); |
244 | + case 1: |
245 | + var weekStartDay = weekViewPath.weekStart.weekStart(Qt.locale().firstDayOfWeek); |
246 | + return weekStartDay.addDays(7); |
247 | } |
248 | } |
249 | } |
250 | } |
251 | } |
252 | + |
253 | + |
254 | |
255 | === modified file 'YearView.qml' |
256 | --- YearView.qml 2014-03-06 11:43:48 +0000 |
257 | +++ YearView.qml 2014-03-20 09:41:42 +0000 |
258 | @@ -3,78 +3,76 @@ |
259 | |
260 | import "dateExt.js" as DateExt |
261 | |
262 | -Page { |
263 | +PathViewBase { |
264 | id: root |
265 | objectName: "YearView" |
266 | + |
267 | property var currentYear: DateExt.today(); |
268 | + |
269 | signal monthSelected(var date); |
270 | |
271 | - PathViewBase { |
272 | - id: pathView |
273 | - |
274 | - anchors.fill: parent |
275 | - |
276 | - onNextItemHighlighted: { |
277 | - root.currentYear = pathView.getDateFromYear(root.currentYear.getFullYear() + 1); |
278 | - } |
279 | - |
280 | - onPreviousItemHighlighted: { |
281 | - root.currentYear = pathView.getDateFromYear(root.currentYear.getFullYear() - 1); |
282 | - } |
283 | - |
284 | - function getDateFromYear(year) { |
285 | - return new Date(year,0,1,0,0,0,0); |
286 | - } |
287 | - |
288 | - delegate: GridView{ |
289 | - id: yearView |
290 | - clip: true |
291 | - |
292 | - property bool isCurrentItem: index == pathView.currentIndex |
293 | - property var year: getYear(); |
294 | - |
295 | - function getYear() { |
296 | - switch( pathView.indexType(index)) { |
297 | - case 0: |
298 | - return root.currentYear; |
299 | - case -1: |
300 | - return pathView.getDateFromYear(root.currentYear.getFullYear() - 1); |
301 | - case 1: |
302 | - return pathView.getDateFromYear(root.currentYear.getFullYear() + 1); |
303 | - } |
304 | + anchors.fill: parent |
305 | + |
306 | + onNextItemHighlighted: { |
307 | + currentYear = getDateFromYear(currentYear.getFullYear() + 1); |
308 | + } |
309 | + |
310 | + onPreviousItemHighlighted: { |
311 | + currentYear = getDateFromYear(currentYear.getFullYear() - 1); |
312 | + } |
313 | + |
314 | + function getDateFromYear(year) { |
315 | + return new Date(year,0,1,0,0,0,0); |
316 | + } |
317 | + |
318 | + delegate: GridView{ |
319 | + id: yearView |
320 | + clip: true |
321 | + |
322 | + property bool isCurrentItem: index == root.currentIndex |
323 | + property var year: getYear(); |
324 | + |
325 | + function getYear() { |
326 | + switch( root.indexType(index)) { |
327 | + case 0: |
328 | + return currentYear; |
329 | + case -1: |
330 | + return getDateFromYear(currentYear.getFullYear() - 1); |
331 | + case 1: |
332 | + return getDateFromYear(currentYear.getFullYear() + 1); |
333 | } |
334 | - |
335 | - width: parent.width |
336 | - height: parent.height |
337 | - anchors.top: parent.top |
338 | - |
339 | - readonly property int minCellWidth: units.gu(30) |
340 | - cellWidth: Math.floor(Math.min.apply(Math, [3, 4].map(function(n) |
341 | + } |
342 | + |
343 | + width: parent.width |
344 | + height: parent.height |
345 | + anchors.top: parent.top |
346 | + |
347 | + readonly property int minCellWidth: units.gu(30) |
348 | + cellWidth: Math.floor(Math.min.apply(Math, [3, 4].map(function(n) |
349 | { return ((width / n >= minCellWidth) ? width / n : width / 2) }))) |
350 | |
351 | - cellHeight: cellWidth * 1.4 |
352 | - |
353 | - model: 12 /* months in a year */ |
354 | - delegate: Item { |
355 | - width: yearView.cellWidth |
356 | - height: yearView.cellHeight |
357 | - |
358 | - MonthComponent{ |
359 | - id: monthComponent |
360 | - monthDate: new Date(yearView.year.getFullYear(),index,1,0,0,0,0) |
361 | + cellHeight: cellWidth * 1.4 |
362 | + |
363 | + model: 12 /* months in a year */ |
364 | + delegate: Item { |
365 | + width: yearView.cellWidth |
366 | + height: yearView.cellHeight |
367 | + |
368 | + MonthComponent{ |
369 | + id: monthComponent |
370 | + monthDate: new Date(yearView.year.getFullYear(),index,1,0,0,0,0) |
371 | + anchors.fill: parent |
372 | + anchors.margins: units.gu(0.5) |
373 | + |
374 | + dayLabelFontSize:"x-small" |
375 | + dateLabelFontSize: "medium" |
376 | + monthLabelFontSize: "medium" |
377 | + yearLabelFontSize: "small" |
378 | + |
379 | + MouseArea{ |
380 | anchors.fill: parent |
381 | - anchors.margins: units.gu(0.5) |
382 | - |
383 | - dayLabelFontSize:"x-small" |
384 | - dateLabelFontSize: "medium" |
385 | - monthLabelFontSize: "medium" |
386 | - yearLabelFontSize: "small" |
387 | - |
388 | - MouseArea{ |
389 | - anchors.fill: parent |
390 | - onClicked: { |
391 | - root.monthSelected(monthComponent.monthDate); |
392 | - } |
393 | + onClicked: { |
394 | + root.monthSelected(monthComponent.monthDate); |
395 | } |
396 | } |
397 | } |
398 | |
399 | === modified file 'calendar.qml' |
400 | --- calendar.qml 2014-03-12 00:17:00 +0000 |
401 | +++ calendar.qml 2014-03-20 09:41:42 +0000 |
402 | @@ -76,16 +76,14 @@ |
403 | property int endtime: -1; |
404 | |
405 | onCurrentDayChanged: { |
406 | - if( monthPage.item |
407 | - && monthPage.item.currentMonth !== undefined |
408 | - && !monthPage.item.currentMonth.isSameDay(currentDay)) |
409 | - monthPage.item.currentMonth = currentDay.midnight(); |
410 | - |
411 | - if( dayPage.item && !dayPage.item.currentDay.isSameDay(currentDay)) |
412 | - dayPage.item.currentDay = currentDay |
413 | - |
414 | - if( weekPage.item && !weekPage.item.dayStart.isSameDay(currentDay)) |
415 | - weekPage.item.dayStart = currentDay |
416 | + if( monthView.currentMonth !== undefined && !monthView.currentMonth.isSameDay(currentDay)) |
417 | + monthView.currentMonth = currentDay.midnight(); |
418 | + |
419 | + if( !dayView.currentDay.isSameDay(currentDay)) |
420 | + dayView.currentDay = currentDay |
421 | + |
422 | + if( !weekView.dayStart.isSameDay(currentDay)) |
423 | + weekView.dayStart = currentDay |
424 | |
425 | setStartEndDateToModel(); |
426 | } |
427 | @@ -135,13 +133,13 @@ |
428 | var difference = endTime - startTime; |
429 | |
430 | if (difference > month) |
431 | - return yearTab.index; // Year view |
432 | + return 0; // Year view |
433 | else if (difference > 7 * day) |
434 | - return monthTab.index; // Month view} |
435 | + return 1; // Month view} |
436 | else if (difference > day) |
437 | - return weekTab.index; // Week view |
438 | + return 2; // Week view |
439 | else |
440 | - return dayTab.index; // Day view |
441 | + return 3; // Day view |
442 | } |
443 | |
444 | // This function parse the argument |
445 | @@ -180,17 +178,17 @@ |
446 | } |
447 | else { |
448 | // If no endtime has been setted, open the starttime date in day view |
449 | - tabs.selectedTabIndex = dayTab.index; |
450 | + tabs.selectedTabIndex = 3; |
451 | } |
452 | } // End of else if (starttime) |
453 | else { |
454 | // Due to bug #1231558 {if (args.defaultArgument.at(0))} is always true |
455 | // After the fix we can delete this else |
456 | - tabs.selectedTabIndex = monthTab.index; |
457 | + tabs.selectedTabIndex= 1; |
458 | } |
459 | } // End of if about args.values |
460 | else { |
461 | - tabs.selectedTabIndex = monthTab.index; |
462 | + tabs.selectedTabIndex= 1; |
463 | } |
464 | |
465 | globalModel = GlobalModel.globalModel(); |
466 | @@ -235,124 +233,71 @@ |
467 | |
468 | Tabs{ |
469 | id: tabs |
470 | - |
471 | Tab{ |
472 | - id: yearTab |
473 | objectName: "yearTab" |
474 | title: i18n.tr("Year") |
475 | - page: Loader{ |
476 | - id: yearPage |
477 | + page: Page{ |
478 | objectName: "yearPage" |
479 | - anchors { |
480 | - top: parent.top |
481 | - left: parent.left |
482 | - right: parent.right |
483 | - bottom: parent.bottom |
484 | - } |
485 | - source: (tabs.selectedTab === yearTab) ? Qt.resolvedUrl("YearView.qml") : "" |
486 | - |
487 | - onLoaded:{ |
488 | - item.tools = commonToolBar |
489 | - } |
490 | - |
491 | - Connections{ |
492 | - target: yearPage.item |
493 | + anchors.fill: parent |
494 | + tools: commonToolBar |
495 | + YearView{ |
496 | onMonthSelected: { |
497 | - tabs.selectedTabIndex = monthTab.index |
498 | + tabs.selectedTabIndex = 1 |
499 | var now = DateExt.today(); |
500 | if( date.getMonth() === now.getMonth() |
501 | && date.getFullYear() === now.getFullYear()) { |
502 | - tabPage.currentDay = now; |
503 | + monthView.currentMonth = now |
504 | } else { |
505 | - tabPage.currentDay = date.midnight(); |
506 | + monthView.currentMonth = date.midnight(); |
507 | } |
508 | } |
509 | } |
510 | } |
511 | } |
512 | - |
513 | Tab { |
514 | id: monthTab |
515 | objectName: "monthTab" |
516 | title: i18n.tr("Month") |
517 | - |
518 | - page: Loader{ |
519 | - id: monthPage |
520 | - anchors { |
521 | - top: parent.top |
522 | - left: parent.left |
523 | - right: parent.right |
524 | - bottom: parent.bottom |
525 | - } |
526 | - |
527 | - source: (tabs.selectedTab === monthTab) ? Qt.resolvedUrl("MonthView.qml") : "" |
528 | - |
529 | - onLoaded: { |
530 | - item.currentMonth = tabPage.currentDay.midnight(); |
531 | - item.tools = commonToolBar |
532 | - } |
533 | - |
534 | - Connections{ |
535 | - target: monthPage.item |
536 | - onDateSelected: { |
537 | - tabs.selectedTabIndex = dayTab.index |
538 | - tabPage.currentDay = date; |
539 | - } |
540 | + page: MonthView{ |
541 | + anchors.fill: parent |
542 | + tools: commonToolBar |
543 | + id: monthView |
544 | + |
545 | + onDateSelected: { |
546 | + tabs.selectedTabIndex = 3 |
547 | + tabPage.currentDay = date; |
548 | } |
549 | } |
550 | } |
551 | - |
552 | Tab{ |
553 | - id: weekTab |
554 | objectName: "weekTab" |
555 | title: i18n.tr("Week") |
556 | - page: Loader{ |
557 | - id: weekPage |
558 | - anchors { |
559 | - top: parent.top |
560 | - left: parent.left |
561 | - right: parent.right |
562 | - bottom: parent.bottom |
563 | - } |
564 | - source: (tabs.selectedTab === weekTab) ? Qt.resolvedUrl("WeekView.qml") : "" |
565 | - |
566 | - onLoaded: { |
567 | - item.dayStart = tabPage.currentDay; |
568 | - item.tools = commonToolBar |
569 | - } |
570 | - |
571 | - Connections{ |
572 | - target: weekPage.item |
573 | + page: Page{ |
574 | + anchors.fill: parent |
575 | + tools: commonToolBar |
576 | + WeekView{ |
577 | + id: weekView |
578 | + anchors.fill: parent |
579 | + |
580 | onDayStartChanged: { |
581 | - tabPage.currentDay = weekPage.item.dayStart; |
582 | + tabPage.currentDay = dayStart; |
583 | } |
584 | } |
585 | } |
586 | } |
587 | |
588 | Tab{ |
589 | - id: dayTab |
590 | objectName: "dayTab" |
591 | title: i18n.tr("Day") |
592 | - page: Loader{ |
593 | - id: dayPage |
594 | - anchors { |
595 | - top: parent.top |
596 | - left: parent.left |
597 | - right: parent.right |
598 | - bottom: parent.bottom |
599 | - } |
600 | - source: (tabs.selectedTab === dayTab) ? Qt.resolvedUrl("DayView.qml") : "" |
601 | - |
602 | - onLoaded: { |
603 | - item.currentDay = tabPage.currentDay; |
604 | - item.tools = commonToolBar |
605 | - } |
606 | - |
607 | - Connections{ |
608 | - target: dayPage.item |
609 | + page: Page{ |
610 | + anchors.fill: parent |
611 | + tools: commonToolBar |
612 | + DayView{ |
613 | + id: dayView |
614 | + anchors.fill: parent |
615 | + |
616 | onCurrentDayChanged: { |
617 | - tabPage.currentDay = dayPage.item.currentDay; |
618 | + tabPage.currentDay = currentDay; |
619 | } |
620 | } |
621 | } |
622 | |
623 | === modified file 'tests/autopilot/calendar_app/emulators.py' |
624 | --- tests/autopilot/calendar_app/emulators.py 2013-12-16 21:32:43 +0000 |
625 | +++ tests/autopilot/calendar_app/emulators.py 2014-03-20 09:41:42 +0000 |
626 | @@ -103,3 +103,6 @@ |
627 | def get_month_name(self, component): |
628 | return component.wait_select_single( |
629 | "Label", objectName="monthLabel").text |
630 | + |
631 | + def get_num_events(self): |
632 | + return len(self.select_many("EventBubble")) |
633 | |
634 | === modified file 'tests/autopilot/calendar_app/tests/__init__.py' |
635 | --- tests/autopilot/calendar_app/tests/__init__.py 2014-01-31 21:15:52 +0000 |
636 | +++ tests/autopilot/calendar_app/tests/__init__.py 2014-03-20 09:41:42 +0000 |
637 | @@ -22,6 +22,12 @@ |
638 | import shutil |
639 | import logging |
640 | |
641 | +try: |
642 | + from unittest import mock |
643 | +except ImportError: |
644 | + import mock |
645 | +import tempfile |
646 | + |
647 | from autopilot.input import Mouse, Touch, Pointer |
648 | from autopilot.platform import model |
649 | from autopilot.testcase import AutopilotTestCase |
650 | @@ -45,15 +51,11 @@ |
651 | |
652 | local_location = "../../calendar.qml" |
653 | installed_location = "/usr/share/calendar-app/calendar.qml" |
654 | - sqlite_dir = os.path.expanduser( |
655 | - "~/.local/share/com.ubuntu.calendar/Databases") |
656 | - backup_dir = sqlite_dir + ".backup" |
657 | |
658 | def setUp(self): |
659 | self.pointing_device = Pointer(self.input_device_class.create()) |
660 | + self.home_dir = self._patch_home() |
661 | super(CalendarTestCase, self).setUp() |
662 | - self.temp_move_sqlite_db() |
663 | - self.addCleanup(self.restore_sqlite_db) |
664 | |
665 | #turn off the OSK so it doesn't block screen elements |
666 | if model() != 'Desktop': |
667 | @@ -73,6 +75,7 @@ |
668 | self.launch_test_click() |
669 | |
670 | def launch_test_local(self): |
671 | + logger.debug("Running via local installation") |
672 | self.app = self.launch_test_application( |
673 | "qmlscene", |
674 | self.local_location, |
675 | @@ -80,6 +83,7 @@ |
676 | emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase) |
677 | |
678 | def launch_test_installed(self): |
679 | + logger.debug("Running via installed debian package") |
680 | self.app = self.launch_test_application( |
681 | "qmlscene", |
682 | self.installed_location, |
683 | @@ -87,39 +91,30 @@ |
684 | emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase) |
685 | |
686 | def launch_test_click(self): |
687 | + logger.debug("Running via click package") |
688 | self.app = self.launch_click_package( |
689 | "com.ubuntu.calendar", |
690 | emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase) |
691 | |
692 | - def temp_move_sqlite_db(self): |
693 | - try: |
694 | - shutil.rmtree(self.backup_dir) |
695 | - except: |
696 | - pass |
697 | - else: |
698 | - logger.warning("Prexisting backup database found and removed") |
699 | - |
700 | - try: |
701 | - shutil.move(self.sqlite_dir, self.backup_dir) |
702 | - except: |
703 | - logger.warning("No current database found") |
704 | - else: |
705 | - logger.debug("Backed up database") |
706 | - |
707 | - def restore_sqlite_db(self): |
708 | - if os.path.exists(self.backup_dir): |
709 | - if os.path.exists(self.sqlite_dir): |
710 | - try: |
711 | - shutil.rmtree(self.sqlite_dir) |
712 | - except: |
713 | - logger.error("Failed to remove test database and restore" / |
714 | - "database") |
715 | - return |
716 | - try: |
717 | - shutil.move(self.backup_dir, self.sqlite_dir) |
718 | - except: |
719 | - logger.error("Failed to restore database") |
720 | + def _patch_home(self): |
721 | + #make a temp dir |
722 | + temp_dir = tempfile.mkdtemp() |
723 | + logger.debug("Created fake home directory " + temp_dir) |
724 | + self.addCleanup(shutil.rmtree, temp_dir) |
725 | + #if the Xauthority file is in home directory |
726 | + #make sure we copy it to temp home, otherwise do nothing |
727 | + xauth = os.path.expanduser(os.path.join('~', '.Xauthority')) |
728 | + if os.path.isfile(xauth): |
729 | + logger.debug("Copying .Xauthority to fake home " + temp_dir) |
730 | + shutil.copyfile( |
731 | + os.path.expanduser(os.path.join('~', '.Xauthority')), |
732 | + os.path.join(temp_dir, '.Xauthority')) |
733 | + patcher = mock.patch.dict('os.environ', {'HOME': temp_dir}) |
734 | + patcher.start() |
735 | + logger.debug("Patched home to fake home directory " + temp_dir) |
736 | + self.addCleanup(patcher.stop) |
737 | + return temp_dir |
738 | |
739 | @property |
740 | def main_view(self): |
741 | - return self.app.select_single(emulators.MainView) |
742 | + return self.app.wait_select_single(emulators.MainView) |
743 | |
744 | === modified file 'tests/autopilot/calendar_app/tests/test_calendar.py' |
745 | --- tests/autopilot/calendar_app/tests/test_calendar.py 2014-01-11 06:05:42 +0000 |
746 | +++ tests/autopilot/calendar_app/tests/test_calendar.py 2014-03-20 09:41:42 +0000 |
747 | @@ -11,7 +11,7 @@ |
748 | |
749 | from autopilot.matchers import Eventually |
750 | |
751 | -from testtools.matchers import Equals, Not, Is |
752 | +from testtools.matchers import Equals, Not, Is, NotEquals |
753 | |
754 | import time |
755 | |
756 | @@ -46,6 +46,10 @@ |
757 | |
758 | def test_new_event(self): |
759 | """test add new event """ |
760 | + #go to today |
761 | + self.main_view.switch_to_tab("dayTab") |
762 | + self.main_view.open_toolbar().click_button("todaybutton") |
763 | + num_events = self.main_view.get_num_events() |
764 | |
765 | #click on new event button |
766 | self.main_view.open_toolbar().click_button("neweventbutton") |
767 | @@ -68,7 +72,7 @@ |
768 | ok = picker.select_single("Button", objectName="TimePickerOKButton") |
769 | self.pointing_device.click_object(ok) |
770 | |
771 | - # Set the end time |
772 | + ## Set the end time |
773 | end_time_field = self.main_view.get_event_end_time_field() |
774 | self.pointing_device.click_object(end_time_field) |
775 | picker = self.main_view.get_time_picker() |
776 | @@ -83,18 +87,16 @@ |
777 | self.keyboard.type("My location") |
778 | self.assertThat(location_field.text, Eventually(Equals("My location"))) |
779 | |
780 | - #input people |
781 | - people_field = self.main_view.get_event_people_field() |
782 | - self.pointing_device.click_object(people_field) |
783 | - self.assertThat(people_field.activeFocus, Eventually(Equals(True))) |
784 | - self.keyboard.type("Me") |
785 | - self.assertThat(people_field.text, Eventually(Equals("Me"))) |
786 | + # scroll to make bottom fields visible |
787 | + self.pointing_device.move_to_object(location_field) |
788 | + x1 = self.main_view.height/2 |
789 | + y1 = self.main_view.width/2 |
790 | + self.pointing_device.drag(x1, y1, x1, y1 - y1/2) |
791 | |
792 | #click save button |
793 | self.main_view.open_toolbar().click_button("eventSaveButton") |
794 | |
795 | #verify that the event has been created in timeline |
796 | - self.main_view.switch_to_tab("dayTab") |
797 | - self.assertThat(lambda: self.main_view.get_label_with_text( |
798 | - eventTitle, root=self.main_view.get_day_view()), |
799 | - Eventually(Not(Is(None)))) |
800 | + self.main_view.open_toolbar().click_button("todaybutton") |
801 | + self.assertThat(self.main_view.get_num_events, |
802 | + Eventually(NotEquals(num_events))) |
FAILED: Continuous integration, rev:222 91.189. 93.70:8080/ job/ubuntu- calendar- app-ci/ 329/ 91.189. 93.70:8080/ job/generic- mediumtests- trusty/ 1820 91.189. 93.70:8080/ job/ubuntu- calendar- app-raring- amd64-ci/ 329/console 91.189. 93.70:8080/ job/ubuntu- calendar- app-saucy- amd64-ci/ 329 91.189. 93.70:8080/ job/ubuntu- calendar- app-trusty- amd64-ci/ 163
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/ubuntu- calendar- app-ci/ 329/rebuild
http://