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
1=== removed file 'Components/Time.js'
2--- Components/Time.js 2013-11-04 15:35:18 +0000
3+++ Components/Time.js 1970-01-01 00:00:00 +0000
4@@ -1,49 +0,0 @@
5-/*
6- * Copyright (C) 2013 Canonical, Ltd.
7- *
8- * This program is free software; you can redistribute it and/or modify
9- * it under the terms of the GNU General Public License as published by
10- * the Free Software Foundation; version 3.
11- *
12- * This program is distributed in the hope that it will be useful,
13- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15- * GNU General Public License for more details.
16- *
17- * You should have received a copy of the GNU General Public License
18- * along with this program. If not, see <http://www.gnu.org/licenses/>.
19- */
20-
21-.pragma library
22-
23-var factors = [
24- [ 1000, "a second ago", "in a second", "%1 seconds ago", "in %1 seconds" ],
25- [ 60, "a minute ago", "in a minute", "%1 minutes ago", "in %1 minutes" ],
26- [ 60, "an hour ago", "in an hour", "%1 hours ago", "in %1 hours" ],
27- [ 24, "yesterday", "tomorrow", "%1 days ago", "in %1 days" ],
28- [ 7, "a week ago", "in a week", "about %1 weeks ago", "in about %1 weeks" ],
29- [ 4.35, "a month ago", "in a month", "%1 months ago", "in %1 months" ], // == 365.25 days / 12 months / 7 days
30- [ 12, "a year ago", "in a year", "%1 years ago", "in %1 years" ]
31-]
32-
33-function readableFromNow(date, now) {
34- var then = new Date(date);
35- if (isNaN(then)) return "";
36- if (now === undefined) {
37- now = new Date();
38- } else if (isNaN(now)) throw "now is NaN";
39- var diff = Math.abs(now - then);
40- if (diff < 1000) return "just now";
41-
42- var future = now < then;
43- var humanDiff;
44- for (var k in factors) {
45- diff /= factors[k][0];
46- if (Math.floor(diff) == 1) {
47- humanDiff = factors[k][future ? 2 : 1];
48- } else if (Math.floor(diff) > 1) {
49- humanDiff = factors[k][future ? 4 : 3].arg(Math.round(diff));
50- } else break;
51- }
52- return humanDiff;
53-}
54
55=== modified file 'tests/qmltests/CMakeLists.txt'
56--- tests/qmltests/CMakeLists.txt 2013-11-11 09:01:28 +0000
57+++ tests/qmltests/CMakeLists.txt 2013-11-19 09:55:06 +0000
58@@ -15,7 +15,6 @@
59 add_qml_test(Components Carousel)
60 add_qml_test(Components OpenEffect)
61 add_qml_test(Components RatingStars)
62-add_qml_test(Components TimeLocal)
63 add_qml_test(Panel IndicatorItem)
64 add_qml_test(utils/Unity/Test UnityTest)
65
66
67=== removed file 'tests/qmltests/Components/tst_TimeLocal.qml'
68--- tests/qmltests/Components/tst_TimeLocal.qml 2013-06-05 22:03:08 +0000
69+++ tests/qmltests/Components/tst_TimeLocal.qml 1970-01-01 00:00:00 +0000
70@@ -1,117 +0,0 @@
71-/*
72- * Copyright 2013 Canonical Ltd.
73- *
74- * This program is free software; you can redistribute it and/or modify
75- * it under the terms of the GNU General Public License as published by
76- * the Free Software Foundation; version 3.
77- *
78- * This program is distributed in the hope that it will be useful,
79- * but WITHOUT ANY WARRANTY; without even the implied warranty of
80- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
81- * GNU General Public License for more details.
82- *
83- * You should have received a copy of the GNU General Public License
84- * along with this program. If not, see <http://www.gnu.org/licenses/>.
85- */
86-
87-import QtQuick 2.0
88-import QtTest 1.0
89-import "../../../Components/Time.js" as TimeLocal
90-
91-TestCase {
92- name: "TimeLocal"
93-
94- property var readableDate
95-
96- function test_readableFromNow_dateUndefined() {
97- readableDate = TimeLocal.readableFromNow()
98- compare(readableDate, "", "readable date should have been null")
99- }
100-
101- function test_readableFromNow_dateNaN() {
102- readableDate = TimeLocal.readableFromNow("this is a string, not a date")
103- compare(readableDate, "", "readable date should have been null")
104- }
105-
106- function test_readableFromNow_justNow() {
107- readableDate = TimeLocal.readableFromNow(new Date())
108- compare(readableDate, "just now", "readable date should have been now")
109- }
110-
111- function test_readableFromNow_nowNaN() {
112- var fail = false
113- try {
114- TimeLocal.readableFromNow(new Date(), "this is a string, not a date")
115- } catch (err) {
116- fail = true
117- } finally {
118- compare(fail, true, "readable date should have thrown an exception")
119- }
120- }
121-
122- function cycleTime(diff, previous, next, units, endIterator) {
123- var now = new Date()
124- var time = now.getTime()
125- readableDate = TimeLocal.readableFromNow(time - diff, now)
126- compare(readableDate, previous, "different time predicted")
127- readableDate = TimeLocal.readableFromNow(time + diff, now)
128- compare(readableDate, next, "different time predicted")
129- for (var i = 2; i < endIterator; i++) {
130- var tmpDiff = i * diff
131- readableDate = TimeLocal.readableFromNow(time - tmpDiff, now)
132- compare(readableDate, i + " " + units + " ago", "different time predicted")
133- readableDate = TimeLocal.readableFromNow(time + tmpDiff, now)
134- compare(readableDate, "in " + i + " " + units, "different time predicted")
135- }
136- }
137-
138- function test_readableFromNow_seconds() {
139- cycleTime(1000, "a second ago", "in a second", "seconds", 60)
140- }
141-
142- function test_readableFromNow_minutes() {
143- cycleTime(1000 * 60, "a minute ago", "in a minute", "minutes", 60)
144- }
145-
146- function test_readableFromNow_hours() {
147- cycleTime(1000 * 60 * 60, "an hour ago", "in an hour", "hours", 24)
148- }
149-
150- function test_readableFromNow_days() {
151- cycleTime(1000 * 60 * 60 * 24, "yesterday", "tomorrow", "days", 7)
152- }
153-
154- function test_readableFromNow_weeks() {
155- var now = new Date()
156- for (var i = 7; i < 30; i++) {
157- readableDate = TimeLocal.readableFromNow(now.getTime() - i * 1000 * 60 * 60 * 24, now)
158- if (i < 14)
159- compare(readableDate, "a week ago", "different time predicted")
160- else if (i < 18)
161- compare(readableDate, "about 2 weeks ago", "different time predicted")
162- else if (i < 25)
163- compare(readableDate, "about 3 weeks ago", "different time predicted")
164- else
165- compare(readableDate, "about 4 weeks ago", "different time predicted")
166- }
167- for (var i = 7; i < 30; i++) {
168- readableDate = TimeLocal.readableFromNow(now.getTime() + i * 1000 * 60 * 60 * 24, now)
169- if (i < 14)
170- compare(readableDate, "in a week", "different time predicted")
171- else if (i < 18)
172- compare(readableDate, "in about 2 weeks", "different time predicted")
173- else if (i < 25)
174- compare(readableDate, "in about 3 weeks", "different time predicted")
175- else
176- compare(readableDate, "in about 4 weeks", "different time predicted")
177- }
178- }
179-
180- function test_readableFromNow_months() {
181- cycleTime(1000 * 60 * 60 * 24 * 30.45, "a month ago", "in a month", "months", 12)
182- }
183-
184- function test_readableFromNow_years() {
185- cycleTime(1000 * 60 * 60 * 24 * 366, "a year ago", "in a year", "years", 5)
186- }
187-}

Subscribers

People subscribed via source and target branches