Merge lp:~aacid/unity8/notime.js into lp:unity8

Proposed by Albert Astals Cid
Status: Merged
Approved by: Michał Sawicz
Approved revision: 535
Merged at revision: 539
Proposed branch: lp:~aacid/unity8/notime.js
Merge into: lp:unity8
Diff against target: 187 lines (+0/-167)
3 files modified
Components/Time.js (+0/-49)
tests/qmltests/CMakeLists.txt (+0/-1)
tests/qmltests/Components/tst_TimeLocal.qml (+0/-117)
To merge this branch: bzr merge lp:~aacid/unity8/notime.js
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Michał Sawicz Approve
Review via email: mp+195733@code.launchpad.net

Commit message

Remove unused Time.js and its test

To post a comment you must log in.
Revision history for this message
Michał Sawicz (saviq) wrote :

Yup.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://jenkins.qa.ubuntu.com/job/unity8-autolanding/722/
Executed test runs:
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/generic-cleanup-mbs/3290
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/871
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/859
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/304
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-autolanding/108
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/108
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/108/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-autolanding/108
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/782
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/871
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/871/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/859
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/859/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/3461
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/1550

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:535
http://jenkins.qa.ubuntu.com/job/unity8-ci/1674/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/878
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/866
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/307
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/197
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/198
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/198/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/197
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/789
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/878
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/878/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/866
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/866/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/3467
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/1556

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/1674/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== removed file 'Components/Time.js'
--- Components/Time.js 2013-11-04 15:35:18 +0000
+++ Components/Time.js 1970-01-01 00:00:00 +0000
@@ -1,49 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17.pragma library
18
19var factors = [
20 [ 1000, "a second ago", "in a second", "%1 seconds ago", "in %1 seconds" ],
21 [ 60, "a minute ago", "in a minute", "%1 minutes ago", "in %1 minutes" ],
22 [ 60, "an hour ago", "in an hour", "%1 hours ago", "in %1 hours" ],
23 [ 24, "yesterday", "tomorrow", "%1 days ago", "in %1 days" ],
24 [ 7, "a week ago", "in a week", "about %1 weeks ago", "in about %1 weeks" ],
25 [ 4.35, "a month ago", "in a month", "%1 months ago", "in %1 months" ], // == 365.25 days / 12 months / 7 days
26 [ 12, "a year ago", "in a year", "%1 years ago", "in %1 years" ]
27]
28
29function readableFromNow(date, now) {
30 var then = new Date(date);
31 if (isNaN(then)) return "";
32 if (now === undefined) {
33 now = new Date();
34 } else if (isNaN(now)) throw "now is NaN";
35 var diff = Math.abs(now - then);
36 if (diff < 1000) return "just now";
37
38 var future = now < then;
39 var humanDiff;
40 for (var k in factors) {
41 diff /= factors[k][0];
42 if (Math.floor(diff) == 1) {
43 humanDiff = factors[k][future ? 2 : 1];
44 } else if (Math.floor(diff) > 1) {
45 humanDiff = factors[k][future ? 4 : 3].arg(Math.round(diff));
46 } else break;
47 }
48 return humanDiff;
49}
500
=== modified file 'tests/qmltests/CMakeLists.txt'
--- tests/qmltests/CMakeLists.txt 2013-11-11 09:01:28 +0000
+++ tests/qmltests/CMakeLists.txt 2013-11-19 09:55:06 +0000
@@ -15,7 +15,6 @@
15add_qml_test(Components Carousel)15add_qml_test(Components Carousel)
16add_qml_test(Components OpenEffect)16add_qml_test(Components OpenEffect)
17add_qml_test(Components RatingStars)17add_qml_test(Components RatingStars)
18add_qml_test(Components TimeLocal)
19add_qml_test(Panel IndicatorItem)18add_qml_test(Panel IndicatorItem)
20add_qml_test(utils/Unity/Test UnityTest)19add_qml_test(utils/Unity/Test UnityTest)
2120
2221
=== removed file 'tests/qmltests/Components/tst_TimeLocal.qml'
--- tests/qmltests/Components/tst_TimeLocal.qml 2013-06-05 22:03:08 +0000
+++ tests/qmltests/Components/tst_TimeLocal.qml 1970-01-01 00:00:00 +0000
@@ -1,117 +0,0 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import QtTest 1.0
19import "../../../Components/Time.js" as TimeLocal
20
21TestCase {
22 name: "TimeLocal"
23
24 property var readableDate
25
26 function test_readableFromNow_dateUndefined() {
27 readableDate = TimeLocal.readableFromNow()
28 compare(readableDate, "", "readable date should have been null")
29 }
30
31 function test_readableFromNow_dateNaN() {
32 readableDate = TimeLocal.readableFromNow("this is a string, not a date")
33 compare(readableDate, "", "readable date should have been null")
34 }
35
36 function test_readableFromNow_justNow() {
37 readableDate = TimeLocal.readableFromNow(new Date())
38 compare(readableDate, "just now", "readable date should have been now")
39 }
40
41 function test_readableFromNow_nowNaN() {
42 var fail = false
43 try {
44 TimeLocal.readableFromNow(new Date(), "this is a string, not a date")
45 } catch (err) {
46 fail = true
47 } finally {
48 compare(fail, true, "readable date should have thrown an exception")
49 }
50 }
51
52 function cycleTime(diff, previous, next, units, endIterator) {
53 var now = new Date()
54 var time = now.getTime()
55 readableDate = TimeLocal.readableFromNow(time - diff, now)
56 compare(readableDate, previous, "different time predicted")
57 readableDate = TimeLocal.readableFromNow(time + diff, now)
58 compare(readableDate, next, "different time predicted")
59 for (var i = 2; i < endIterator; i++) {
60 var tmpDiff = i * diff
61 readableDate = TimeLocal.readableFromNow(time - tmpDiff, now)
62 compare(readableDate, i + " " + units + " ago", "different time predicted")
63 readableDate = TimeLocal.readableFromNow(time + tmpDiff, now)
64 compare(readableDate, "in " + i + " " + units, "different time predicted")
65 }
66 }
67
68 function test_readableFromNow_seconds() {
69 cycleTime(1000, "a second ago", "in a second", "seconds", 60)
70 }
71
72 function test_readableFromNow_minutes() {
73 cycleTime(1000 * 60, "a minute ago", "in a minute", "minutes", 60)
74 }
75
76 function test_readableFromNow_hours() {
77 cycleTime(1000 * 60 * 60, "an hour ago", "in an hour", "hours", 24)
78 }
79
80 function test_readableFromNow_days() {
81 cycleTime(1000 * 60 * 60 * 24, "yesterday", "tomorrow", "days", 7)
82 }
83
84 function test_readableFromNow_weeks() {
85 var now = new Date()
86 for (var i = 7; i < 30; i++) {
87 readableDate = TimeLocal.readableFromNow(now.getTime() - i * 1000 * 60 * 60 * 24, now)
88 if (i < 14)
89 compare(readableDate, "a week ago", "different time predicted")
90 else if (i < 18)
91 compare(readableDate, "about 2 weeks ago", "different time predicted")
92 else if (i < 25)
93 compare(readableDate, "about 3 weeks ago", "different time predicted")
94 else
95 compare(readableDate, "about 4 weeks ago", "different time predicted")
96 }
97 for (var i = 7; i < 30; i++) {
98 readableDate = TimeLocal.readableFromNow(now.getTime() + i * 1000 * 60 * 60 * 24, now)
99 if (i < 14)
100 compare(readableDate, "in a week", "different time predicted")
101 else if (i < 18)
102 compare(readableDate, "in about 2 weeks", "different time predicted")
103 else if (i < 25)
104 compare(readableDate, "in about 3 weeks", "different time predicted")
105 else
106 compare(readableDate, "in about 4 weeks", "different time predicted")
107 }
108 }
109
110 function test_readableFromNow_months() {
111 cycleTime(1000 * 60 * 60 * 24 * 30.45, "a month ago", "in a month", "months", 12)
112 }
113
114 function test_readableFromNow_years() {
115 cycleTime(1000 * 60 * 60 * 24 * 366, "a year ago", "in a year", "years", 5)
116 }
117}

Subscribers

People subscribed via source and target branches