Merge lp:~doflah/ubuntu-calendar-app/testing into lp:ubuntu-calendar-app
- testing
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Olivier Tilloy |
Approved revision: | 126 |
Merged at revision: | 122 |
Proposed branch: | lp:~doflah/ubuntu-calendar-app/testing |
Merge into: | lp:ubuntu-calendar-app |
Diff against target: |
135 lines (+108/-0) 3 files modified
debian/control (+4/-0) debian/rules (+3/-0) tests/unittests/tst_date.qml (+101/-0) |
To merge this branch: | bzr merge lp:~doflah/ubuntu-calendar-app/testing |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Olivier Tilloy (community) | Approve | ||
Review via email:
|
Commit message
Add unit tests for JS date functions.
Description of the change
Add unit tests for js date functions.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Dennis O'Flaherty (doflah) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Olivier Tilloy (osomon) wrote : | # |
91 + compare(
92 + compare(
I guess this should be "Today’s month" and "Today’s day".
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Dennis O'Flaherty (doflah) wrote : | # |
Fixed. Thanks for catching that.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Olivier Tilloy (osomon) wrote : | # |
Overall this looks like a great addition to the already existing autopilot tests, to ensure no regressions in the JS helpers. Thanks for this!
A few remarks:
- For consistency with other apps, instead of "unit-tests/", I would place those tests under "tests/unittests/" (when you do that you’ll have to add another "../" to the import statement for dateExt.js.
- It would be great to have the build system automatically run those tests when building a package. To achieve this, you’ll need to apply the following changes:
=== modified file 'debian/control'
--- debian/control 2013-08-20 08:24:45 +0000
+++ debian/control 2013-09-23 11:23:04 +0000
@@ -1,7 +1,8 @@
Source: calendar-app
Priority: extra
Maintainer: Ubuntu App Cats <email address hidden>
-Build-Depends: debhelper (>= 9),
+Build-Depends: debhelper (>= 9),
+ qtdeclarative5-
Standards-Version: 3.9.4
Section: misc
Homepage: https:/
=== modified file 'debian/rules'
--- debian/rules 2013-06-17 11:10:21 +0000
+++ debian/rules 2013-09-23 11:20:25 +0000
@@ -7,6 +7,9 @@
%:
dh $@
+override_
+ QT_QPA_
+
override_
dh_install --fail-missing
appname=
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Olivier Tilloy (osomon) wrote : | # |
Thanks for the changes!
I’ve had a go at building a package in a saucy chroot, and it appears we are missing the following build dependencies:
qt5-default,
qtdeclarati
qtdeclarati
(on top of qtdeclarative5-
Can you please add those to the Build-Depends section (and while you’re at it, ensure they are all aligned on the same column as the first dependency, using spaces not tabs)?
Thanks!
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Dennis O'Flaherty (doflah) wrote : | # |
No problem! Hopefully you should be all set now.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Olivier Tilloy (osomon) wrote : | # |
Looks perfect now!
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Olivier Tilloy (osomon) wrote : | # |
It looks like there a problem with the jenkins setup, it can’t find the Qt5 build dependencies on precise and quantal, I asked the CI team to look into this.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:126
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:126
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:126
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:126
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:126
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'debian/control' | |||
2 | --- debian/control 2013-08-20 08:24:45 +0000 | |||
3 | +++ debian/control 2013-09-24 11:19:44 +0000 | |||
4 | @@ -2,6 +2,10 @@ | |||
5 | 2 | Priority: extra | 2 | Priority: extra |
6 | 3 | Maintainer: Ubuntu App Cats <ubuntu-touch-coreapps@lists.launchpad.net> | 3 | Maintainer: Ubuntu App Cats <ubuntu-touch-coreapps@lists.launchpad.net> |
7 | 4 | Build-Depends: debhelper (>= 9), | 4 | Build-Depends: debhelper (>= 9), |
8 | 5 | qtdeclarative5-dev-tools, | ||
9 | 6 | qt5-default, | ||
10 | 7 | qtdeclarative5-qtquick2-plugin, | ||
11 | 8 | qtdeclarative5-test-plugin, | ||
12 | 5 | Standards-Version: 3.9.4 | 9 | Standards-Version: 3.9.4 |
13 | 6 | Section: misc | 10 | Section: misc |
14 | 7 | Homepage: https://launchpad.net/ubuntu-calendar-app | 11 | Homepage: https://launchpad.net/ubuntu-calendar-app |
15 | 8 | 12 | ||
16 | === modified file 'debian/rules' | |||
17 | --- debian/rules 2013-06-17 11:10:21 +0000 | |||
18 | +++ debian/rules 2013-09-24 11:19:44 +0000 | |||
19 | @@ -7,6 +7,9 @@ | |||
20 | 7 | %: | 7 | %: |
21 | 8 | dh $@ | 8 | dh $@ |
22 | 9 | 9 | ||
23 | 10 | override_dh_auto_test: | ||
24 | 11 | QT_QPA_PLATFORM=minimal qmltestrunner -input tests/unittests/ | ||
25 | 12 | |||
26 | 10 | override_dh_install: | 13 | override_dh_install: |
27 | 11 | dh_install --fail-missing | 14 | dh_install --fail-missing |
28 | 12 | appname=calendar-app; \ | 15 | appname=calendar-app; \ |
29 | 13 | 16 | ||
30 | === added directory 'tests/unittests' | |||
31 | === added file 'tests/unittests/tst_date.qml' | |||
32 | --- tests/unittests/tst_date.qml 1970-01-01 00:00:00 +0000 | |||
33 | +++ tests/unittests/tst_date.qml 2013-09-24 11:19:44 +0000 | |||
34 | @@ -0,0 +1,101 @@ | |||
35 | 1 | import QtQuick 2.0 | ||
36 | 2 | import QtTest 1.0 | ||
37 | 3 | import "../../dateExt.js" as DATE | ||
38 | 4 | |||
39 | 5 | TestCase{ | ||
40 | 6 | name: "Date tests" | ||
41 | 7 | |||
42 | 8 | // Data \\ | ||
43 | 9 | |||
44 | 10 | function test_leap_year_data() { | ||
45 | 11 | return [{year:2013}, {year: 2000}, {year: 2012}, {year: 2100}]; | ||
46 | 12 | } | ||
47 | 13 | |||
48 | 14 | function test_days_per_month_data() { | ||
49 | 15 | return [ | ||
50 | 16 | // all months in a non-leap year | ||
51 | 17 | new Date(2013, 0), | ||
52 | 18 | new Date(2013, 1), | ||
53 | 19 | new Date(2013, 2), | ||
54 | 20 | new Date(2013, 3), | ||
55 | 21 | new Date(2013, 4), | ||
56 | 22 | new Date(2013, 5), | ||
57 | 23 | new Date(2013, 6), | ||
58 | 24 | new Date(2013, 7), | ||
59 | 25 | new Date(2013, 8), | ||
60 | 26 | new Date(2013, 9), | ||
61 | 27 | new Date(2013, 10), | ||
62 | 28 | new Date(2013, 11), | ||
63 | 29 | // Feb in leap year, century, and millenium | ||
64 | 30 | new Date(2112, 1), | ||
65 | 31 | new Date(2000, 1), | ||
66 | 32 | new Date(2100, 1) | ||
67 | 33 | ]; | ||
68 | 34 | } | ||
69 | 35 | |||
70 | 36 | function test_add_days_data() { | ||
71 | 37 | return [ | ||
72 | 38 | // regular add days | ||
73 | 39 | { start: new Date(2013, 0, 1), days: 4, end: new Date(2013, 0, 5)}, | ||
74 | 40 | // start daylight savings: March 10, 2013 | ||
75 | 41 | { start: new Date(2013, 2, 10), days: 1, end: new Date(2013, 2, 11)}, | ||
76 | 42 | // end daylight savings: November 3, 2013 | ||
77 | 43 | { start: new Date(2013, 10, 3), days: 1, end: new Date(2013, 10, 4)}, | ||
78 | 44 | // cross month boundary | ||
79 | 45 | { start: new Date(2013, 2, 31), days: 2, end: new Date(2013, 3, 2)}, | ||
80 | 46 | // cross year boundary | ||
81 | 47 | { start: new Date(2013, 11, 31), days: 2, end: new Date(2014, 0, 2)}, | ||
82 | 48 | ]; | ||
83 | 49 | } | ||
84 | 50 | |||
85 | 51 | function test_add_months_data() { | ||
86 | 52 | return [ | ||
87 | 53 | // regular add months | ||
88 | 54 | { start: new Date(2013, 0, 1), months: 1, end: new Date(2013, 1, 1)}, | ||
89 | 55 | // add multiple months | ||
90 | 56 | { start: new Date(2013, 0, 1), months: 4, end: new Date(2013, 4, 1)}, | ||
91 | 57 | // start daylight savings: March 10, 2013 | ||
92 | 58 | { start: new Date(2013, 2, 1), months: 1, end: new Date(2013, 3, 1)}, | ||
93 | 59 | // end daylight savings: November 3, 2013 | ||
94 | 60 | { start: new Date(2013, 10, 1), months: 1, end: new Date(2013, 11, 1)}, | ||
95 | 61 | // cross year boundary | ||
96 | 62 | { start: new Date(2013, 11, 1), months: 1, end: new Date(2014, 0, 1)}, | ||
97 | 63 | ]; | ||
98 | 64 | } | ||
99 | 65 | |||
100 | 66 | // Tests \\ | ||
101 | 67 | |||
102 | 68 | function test_days_per_month(month) { | ||
103 | 69 | compare(Date.daysInMonth(month.getFullYear(), month.getMonth()), | ||
104 | 70 | new Date(month.getFullYear(), month.getMonth() + 1, 0).getDate(), | ||
105 | 71 | Qt.locale().standaloneMonthName(month.getMonth()) + ", " + month.getFullYear()); | ||
106 | 72 | } | ||
107 | 73 | |||
108 | 74 | function test_leap_year(test) { | ||
109 | 75 | compare(Date.leapYear(test.year), new Date(test.year, 2, 0).getDate() == 29, "Check if Feb, " + test.year + " has the right number of days."); | ||
110 | 76 | } | ||
111 | 77 | |||
112 | 78 | function test_midnight() { | ||
113 | 79 | var date = new Date(); | ||
114 | 80 | compare(date.midnight(), new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0, 0), "Midnight"); | ||
115 | 81 | } | ||
116 | 82 | |||
117 | 83 | function test_today() { | ||
118 | 84 | var todayReal = new Date(), todayTest = DATE.today(); | ||
119 | 85 | compare(todayTest.getFullYear(), todayReal.getFullYear(), "Today's year"); | ||
120 | 86 | compare(todayTest.getMonth(), todayReal.getMonth(), "Today's month"); | ||
121 | 87 | compare(todayTest.getDate(), todayReal.getDate(), "Today's date"); | ||
122 | 88 | compare(todayTest.getHours(), 0, "Midnight, zero hours"); | ||
123 | 89 | compare(todayTest.getMinutes(), 0, "Midnight, zero minutes"); | ||
124 | 90 | compare(todayTest.getSeconds(), 0, "Midnight, zero seconds"); | ||
125 | 91 | } | ||
126 | 92 | |||
127 | 93 | function test_add_days(test) { | ||
128 | 94 | compare(test.start.addDays(test.days), test.end, test.start + " + " + test.days + " days"); | ||
129 | 95 | } | ||
130 | 96 | |||
131 | 97 | function test_add_months(test) { | ||
132 | 98 | compare(test.start.addMonths(test.months), test.end, test.start + " + " + test.months + " months"); | ||
133 | 99 | } | ||
134 | 100 | |||
135 | 101 | } |
Some of the routines in dateExt.js aren't used anywhere or seem to be duplicated, so it may be worth cleaning that file up in addition to adding the tests.