Merge lp:~yohanboniface/ubuntu-calendar-app/fix1279933 into lp:ubuntu-calendar-app

Proposed by ybon
Status: Merged
Approved by: Kunal Parmar
Approved revision: 212
Merged at revision: 215
Proposed branch: lp:~yohanboniface/ubuntu-calendar-app/fix1279933
Merge into: lp:ubuntu-calendar-app
Diff against target: 48 lines (+13/-4)
3 files modified
TimeLineBase.qml (+2/-4)
dateExt.js (+6/-0)
tests/unittests/tst_date.qml (+5/-0)
To merge this branch: bzr merge lp:~yohanboniface/ubuntu-calendar-app/fix1279933
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Olivier Tilloy (community) Approve
Review via email: mp+208970@code.launchpad.net

Commit message

Add a method for getting the correct end of day date, and use it on dayview.

Description of the change

Add a method for getting the correct end of day date, and use it on dayview.

To post a comment you must log in.
Revision history for this message
Olivier Tilloy (osomon) wrote :

Thanks for the patch Yohan! I tested it and it seems to fix the issue, nice job.

Looking at the bug report, you were looking at writing tests. The calendar application has two types of tests:

 - unit tests that essentially test the helpers in dateExt.js
 - autopilot tests that test the UI and user interaction (they’re more like integration tests)

For this specific issue, I guess we could write both types of tests, but a good start would be to add a unit test for the new endOfDay() function. You can do that by adding a test to tests/unittests/tst_date.qml.
To execute the unit tests, just run:

    cmake .
    ctest -V

I’m approving as anyways it is good to be merged as is, the tests would be a nice addition but not strictly necessary.

review: Approve
Revision history for this message
ybon (yohanboniface) wrote :

Done :)

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

FAILED: Autolanding.
No commit message was specified in the merge proposal. Hit 'Add commit message' on the merge proposal web page or follow the link below. You can approve the merge proposal yourself to rerun.
https://code.launchpad.net/~yohanboniface/ubuntu-calendar-app/fix1279933/+merge/208970/+edit-commit-message

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'TimeLineBase.qml'
2--- TimeLineBase.qml 2014-01-31 03:20:40 +0000
3+++ TimeLineBase.qml 2014-03-03 11:34:43 +0000
4@@ -40,11 +40,9 @@
5 function createEvents() {
6 bubbleOverLay.destroyAllChildren();
7
8- var startDate = new Date(day);
9- startDate.setHours(0,0,0,0);
10+ var startDate = new Date(day).midnight();
11
12- var endDate = startDate.addDays(1);
13- endDate.setHours(0,0,0,0);
14+ var endDate = new Date(day).endOfDay();
15
16 var itemIds = intern.model.itemIds(startDate,endDate);
17 for(var i = 0 ; i < itemIds.length ; ++i) {
18
19=== modified file 'dateExt.js'
20--- dateExt.js 2013-09-03 23:46:17 +0000
21+++ dateExt.js 2014-03-03 11:34:43 +0000
22@@ -35,6 +35,12 @@
23 return date
24 }
25
26+Date.prototype.endOfDay = function() {
27+ var date = new Date(this)
28+ date.setHours(23,59,59,0);
29+ return date
30+}
31+
32 Date.prototype.addDays = function(days) {
33 var date = new Date(this)
34 date.setDate(date.getDate() + days);
35
36=== modified file 'tests/unittests/tst_date.qml'
37--- tests/unittests/tst_date.qml 2013-09-23 11:32:47 +0000
38+++ tests/unittests/tst_date.qml 2014-03-03 11:34:43 +0000
39@@ -98,4 +98,9 @@
40 compare(test.start.addMonths(test.months), test.end, test.start + " + " + test.months + " months");
41 }
42
43+ function test_endOfDay(test) {
44+ var d = new Date(2014, 2, 3)
45+ compare(d.endOfDay(), new Date(2014, 2, 3, 23, 59, 59, 0));
46+ }
47+
48 }

Subscribers

People subscribed via source and target branches

to status/vote changes: