Merge lp:~fourdollars/indicator-power/zesty into lp:indicator-power

Proposed by Shih-Yuan Lee
Status: Merged
Merge reported by: Shih-Yuan Lee
Merged at revision: not available
Proposed branch: lp:~fourdollars/indicator-power/zesty
Merge into: lp:indicator-power
Diff against target: 528 lines (+134/-73)
7 files modified
src/device-provider-upower.c (+5/-1)
src/device.c (+37/-5)
src/device.h (+4/-1)
src/service.c (+18/-6)
src/testing.c (+2/-1)
tests/test-device.cc (+62/-56)
tests/test-notify.cc (+6/-3)
To merge this branch: bzr merge lp:~fourdollars/indicator-power/zesty
Reviewer Review Type Date Requested Status
Sebastien Bacher Needs Information
unity-api-1-bot continuous-integration Needs Fixing
Review via email: mp+314124@code.launchpad.net

Description of the change

Make device with power supply has higher sorting priority. (LP: #1100546)

To post a comment you must log in.
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

FAILED: Continuous integration, rev:302
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~fourdollars/indicator-power/zesty/+merge/314124/+edit-commit-message

https://jenkins.canonical.com/unity-api-1/job/lp-indicator-power-ci/4/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build/1313/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/1320
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1097
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1097/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1097
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1097/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1097/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1097
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1097/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1097
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1097/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1097/console

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-indicator-power-ci/4/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :
review: Needs Information
Revision history for this message
Shih-Yuan Lee (fourdollars) wrote :

> that's superseeded by https://code.launchpad.net/~charlesk/indicator-
> power/lp-1100546-not-present-mouse/+merge/314869 right?
Yes

Revision history for this message
Shih-Yuan Lee (fourdollars) wrote :

> > that's superseeded by https://code.launchpad.net/~charlesk/indicator-
> > power/lp-1100546-not-present-mouse/+merge/314869 right?
> Yes
Sorry, I mean https://code.launchpad.net/~charlesk/indicator-power/lp-1100546-not-present-mouse/+merge/314869 just used the same code of this merge proposal.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/device-provider-upower.c'
2--- src/device-provider-upower.c 2014-09-08 14:50:22 +0000
3+++ src/device-provider-upower.c 2017-01-05 04:40:17 +0000
4@@ -113,6 +113,7 @@
5 gint64 time_to_empty = 0;
6 gint64 time_to_full = 0;
7 gint64 time;
8+ gboolean power_supply = FALSE;
9 IndicatorPowerDevice * device;
10 priv_t * p = get_priv(data->self);
11 GVariant * dict = g_variant_get_child_value (response, 0);
12@@ -122,6 +123,7 @@
13 g_variant_lookup (dict, "Percentage", "d", &percentage);
14 g_variant_lookup (dict, "TimeToEmpty", "x", &time_to_empty);
15 g_variant_lookup (dict, "TimeToFull", "x", &time_to_full);
16+ g_variant_lookup (dict, "PowerSupply", "b", &power_supply);
17 time = time_to_empty ? time_to_empty : time_to_full;
18
19 if ((device = g_hash_table_lookup (p->devices, data->path)))
20@@ -131,6 +133,7 @@
21 INDICATOR_POWER_DEVICE_OBJECT_PATH, data->path,
22 INDICATOR_POWER_DEVICE_PERCENTAGE, percentage,
23 INDICATOR_POWER_DEVICE_TIME, time,
24+ INDICATOR_POWER_DEVICE_POWER_SUPPLY, power_supply,
25 NULL);
26 }
27 else
28@@ -139,7 +142,8 @@
29 kind,
30 percentage,
31 state,
32- (time_t)time);
33+ (time_t)time,
34+ power_supply);
35
36 g_hash_table_insert (p->devices,
37 g_strdup (data->path),
38
39=== modified file 'src/device.c'
40--- src/device.c 2016-05-26 18:32:08 +0000
41+++ src/device.c 2017-01-05 04:40:17 +0000
42@@ -42,6 +42,7 @@
43 the time-remaining field for this device, or 0 if not applicable.
44 This is used when generating the time-remaining string. */
45 GTimer * inestimable;
46+ gboolean power_supply;
47 };
48
49 /* Properties */
50@@ -53,6 +54,7 @@
51 PROP_OBJECT_PATH,
52 PROP_PERCENTAGE,
53 PROP_TIME,
54+ PROP_POWER_SUPPLY,
55 N_PROPERTIES
56 };
57
58@@ -116,6 +118,12 @@
59 0,
60 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
61
62+ properties[PROP_POWER_SUPPLY] = g_param_spec_boolean (INDICATOR_POWER_DEVICE_POWER_SUPPLY,
63+ "power supply",
64+ "The device's power supply",
65+ FALSE,
66+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
67+
68 g_object_class_install_properties (object_class, N_PROPERTIES, properties);
69 }
70
71@@ -132,6 +140,7 @@
72 priv->object_path = NULL;
73 priv->percentage = 0.0;
74 priv->time = 0;
75+ priv->power_supply = FALSE;
76
77 self->priv = priv;
78 }
79@@ -190,6 +199,10 @@
80 g_value_set_uint64 (value, (guint64)priv->time);
81 break;
82
83+ case PROP_POWER_SUPPLY:
84+ g_value_set_boolean (value, priv->power_supply);
85+ break;
86+
87 default:
88 G_OBJECT_WARN_INVALID_PROPERTY_ID(o, prop_id, pspec);
89 break;
90@@ -225,6 +238,10 @@
91 p->time = (time_t) g_value_get_uint64(value);
92 break;
93
94+ case PROP_POWER_SUPPLY:
95+ p->power_supply = g_value_get_boolean (value);
96+ break;
97+
98 default:
99 G_OBJECT_WARN_INVALID_PROPERTY_ID(o, prop_id, pspec);
100 break;
101@@ -304,6 +321,16 @@
102 return device->priv->time;
103 }
104
105+gboolean
106+indicator_power_device_get_power_supply (const IndicatorPowerDevice * device)
107+{
108+ /* LCOV_EXCL_START */
109+ g_return_val_if_fail (INDICATOR_IS_POWER_DEVICE(device), FALSE);
110+ /* LCOV_EXCL_STOP */
111+
112+ return device->priv->power_supply;
113+}
114+
115 /***
116 ****
117 ****
118@@ -867,7 +894,8 @@
119 UpDeviceKind kind,
120 gdouble percentage,
121 UpDeviceState state,
122- time_t timestamp)
123+ time_t timestamp,
124+ gboolean power_supply)
125 {
126 GObject * o = g_object_new (INDICATOR_POWER_DEVICE_TYPE,
127 INDICATOR_POWER_DEVICE_KIND, kind,
128@@ -875,6 +903,7 @@
129 INDICATOR_POWER_DEVICE_OBJECT_PATH, object_path,
130 INDICATOR_POWER_DEVICE_PERCENTAGE, percentage,
131 INDICATOR_POWER_DEVICE_TIME, (guint64)timestamp,
132+ INDICATOR_POWER_DEVICE_POWER_SUPPLY, power_supply,
133 NULL);
134 return INDICATOR_POWER_DEVICE(o);
135 }
136@@ -882,7 +911,7 @@
137 IndicatorPowerDevice *
138 indicator_power_device_new_from_variant (GVariant * v)
139 {
140- g_return_val_if_fail (g_variant_is_of_type (v, G_VARIANT_TYPE("(susdut)")), NULL);
141+ g_return_val_if_fail (g_variant_is_of_type (v, G_VARIANT_TYPE("(susdutb)")), NULL);
142
143 UpDeviceKind kind = UP_DEVICE_KIND_UNKNOWN;
144 UpDeviceState state = UP_DEVICE_STATE_UNKNOWN;
145@@ -890,18 +919,21 @@
146 const gchar * object_path = NULL;
147 gdouble percentage = 0;
148 guint64 time = 0;
149+ gboolean power_supply = FALSE;
150
151- g_variant_get (v, "(&su&sdut)",
152+ g_variant_get (v, "(&su&sdutb)",
153 &object_path,
154 &kind,
155 &icon,
156 &percentage,
157 &state,
158- &time);
159+ &time,
160+ &power_supply);
161
162 return indicator_power_device_new (object_path,
163 kind,
164 percentage,
165 state,
166- (time_t)time);
167+ (time_t)time,
168+ power_supply);
169 }
170
171=== modified file 'src/device.h'
172--- src/device.h 2014-07-24 20:20:16 +0000
173+++ src/device.h 2017-01-05 04:40:17 +0000
174@@ -44,6 +44,7 @@
175 #define INDICATOR_POWER_DEVICE_OBJECT_PATH "object-path"
176 #define INDICATOR_POWER_DEVICE_PERCENTAGE "percentage"
177 #define INDICATOR_POWER_DEVICE_TIME "time"
178+#define INDICATOR_POWER_DEVICE_POWER_SUPPLY "power-supply"
179
180 typedef enum
181 {
182@@ -107,7 +108,8 @@
183 UpDeviceKind kind,
184 gdouble percentage,
185 UpDeviceState state,
186- time_t time);
187+ time_t time,
188+ gboolean power_supply);
189
190 /**
191 * Convenience wrapper around indicator_power_device_new()
192@@ -121,6 +123,7 @@
193 const gchar * indicator_power_device_get_object_path (const IndicatorPowerDevice * device);
194 gdouble indicator_power_device_get_percentage (const IndicatorPowerDevice * device);
195 time_t indicator_power_device_get_time (const IndicatorPowerDevice * device);
196+gboolean indicator_power_device_get_power_supply (const IndicatorPowerDevice * device);
197
198 GStrv indicator_power_device_get_icon_names (const IndicatorPowerDevice * device);
199 GIcon * indicator_power_device_get_gicon (const IndicatorPowerDevice * device);
200
201=== modified file 'src/service.c'
202--- src/service.c 2016-05-26 18:21:09 +0000
203+++ src/service.c 2017-01-05 04:40:17 +0000
204@@ -162,11 +162,12 @@
205 }
206
207 /* sort devices from most interesting to least interesting on this criteria:
208- 1. discharging items from least time remaining until most time remaining
209- 2. charging items from most time left to charge to least time left to charge
210- 3. charging items with an unknown time remaining
211- 4. discharging items with an unknown time remaining
212- 5. batteries, then non-line power, then line-power */
213+ 1. device that supplied the power to the system
214+ 2. discharging items from least time remaining until most time remaining
215+ 3. charging items from most time left to charge to least time left to charge
216+ 4. charging items with an unknown time remaining
217+ 5. discharging items with an unknown time remaining
218+ 6. batteries, then non-line power, then line-power */
219 static gint
220 device_compare_func (gconstpointer ga, gconstpointer gb)
221 {
222@@ -174,6 +175,8 @@
223 int state;
224 const IndicatorPowerDevice * a = ga;
225 const IndicatorPowerDevice * b = gb;
226+ const gboolean a_power_supply = indicator_power_device_get_power_supply (a);
227+ const gboolean b_power_supply = indicator_power_device_get_power_supply (b);
228 const int a_state = indicator_power_device_get_state (a);
229 const int b_state = indicator_power_device_get_state (b);
230 const gdouble a_percentage = indicator_power_device_get_percentage (a);
231@@ -183,6 +186,14 @@
232
233 ret = 0;
234
235+ if (!ret)
236+ {
237+ if (a_power_supply == TRUE && b_power_supply == FALSE)
238+ ret = -1;
239+ else if (a_power_supply == FALSE && b_power_supply == TRUE)
240+ ret = 1;
241+ }
242+
243 state = UP_DEVICE_STATE_DISCHARGING;
244 if (!ret && (((a_state == state) && a_time) ||
245 ((b_state == state) && b_time)))
246@@ -1436,7 +1447,8 @@
247 UP_DEVICE_KIND_BATTERY,
248 percent,
249 state,
250- time_left);
251+ time_left,
252+ TRUE);
253 }
254
255 return device;
256
257=== modified file 'src/testing.c'
258--- src/testing.c 2014-10-14 19:50:47 +0000
259+++ src/testing.c 2017-01-05 04:40:17 +0000
260@@ -301,7 +301,8 @@
261 UP_DEVICE_KIND_BATTERY,
262 50.0,
263 UP_DEVICE_STATE_DISCHARGING,
264- 60*30);
265+ 60*30,
266+ TRUE);
267
268
269 /* Mock Provider */
270
271=== modified file 'tests/test-device.cc'
272--- tests/test-device.cc 2016-05-26 19:02:10 +0000
273+++ tests/test-device.cc 2017-01-05 04:40:17 +0000
274@@ -205,7 +205,8 @@
275 UP_DEVICE_KIND_BATTERY,
276 50.0,
277 UP_DEVICE_STATE_CHARGING,
278- 30);
279+ 30,
280+ TRUE);
281 ASSERT_TRUE (device != NULL);
282 ASSERT_TRUE (INDICATOR_IS_POWER_DEVICE(device));
283 ASSERT_EQ (UP_DEVICE_KIND_BATTERY, indicator_power_device_get_kind(device));
284@@ -213,6 +214,7 @@
285 ASSERT_STREQ ("/object/path", indicator_power_device_get_object_path(device));
286 ASSERT_EQ (50, int(indicator_power_device_get_percentage(device)));
287 ASSERT_EQ (30, indicator_power_device_get_time(device));
288+ ASSERT_TRUE (indicator_power_device_get_power_supply(device));
289
290 // cleanup
291 g_object_unref (device);
292@@ -220,13 +222,14 @@
293
294 TEST_F(DeviceTest, NewFromVariant)
295 {
296- auto variant = g_variant_new("(susdut)",
297+ auto variant = g_variant_new("(susdutb)",
298 "/object/path",
299 guint32(UP_DEVICE_KIND_BATTERY),
300 "icon",
301 50.0,
302 guint32(UP_DEVICE_STATE_CHARGING),
303- guint64(30));
304+ guint64(30),
305+ TRUE);
306 IndicatorPowerDevice * device = indicator_power_device_new_from_variant (variant);
307 ASSERT_TRUE (variant != NULL);
308 ASSERT_TRUE (device != NULL);
309@@ -236,6 +239,7 @@
310 ASSERT_STREQ ("/object/path", indicator_power_device_get_object_path(device));
311 ASSERT_EQ (50, int(indicator_power_device_get_percentage(device)));
312 ASSERT_EQ (30, indicator_power_device_get_time(device));
313+ ASSERT_TRUE (indicator_power_device_get_power_supply(device));
314
315 // cleanup
316 g_object_unref (device);
317@@ -810,7 +814,8 @@
318 << ' ' << state2str(indicator_power_device_get_state(device))
319 << ' ' << indicator_power_device_get_time(device)<<'m'
320 << ' ' << int(ceil(indicator_power_device_get_percentage(device)))<<'%'
321- << ' ' << (path ? path : "nopath");
322+ << ' ' << (path ? path : "nopath")
323+ << ' ' << (indicator_power_device_get_power_supply(device) ? "1" : "0");
324
325 return o.str();
326 }
327@@ -818,13 +823,14 @@
328 IndicatorPowerDevice* str2device(const std::string& str)
329 {
330 auto tokens = g_strsplit(str.c_str(), " ", 0);
331- g_assert(5u == g_strv_length(tokens));
332+ g_assert(6u == g_strv_length(tokens));
333 const auto kind = str2kind(tokens[0]);
334 const auto state = str2state(tokens[1]);
335 const time_t time = atoi(tokens[2]);
336 const double pct = strtod(tokens[3],nullptr);
337 const char* path = !g_strcmp0(tokens[4],"nopath") ? nullptr : tokens[4];
338- auto ret = indicator_power_device_new(path, kind, pct, state, time);
339+ const gboolean power_supply = atoi(tokens[5]);
340+ auto ret = indicator_power_device_new(path, kind, pct, state, time, power_supply);
341 g_strfreev(tokens);
342 return ret;
343 }
344@@ -847,100 +853,100 @@
345 } tests[] = {
346 {
347 "one discharging battery",
348- "battery discharging 10m 60% bat01",
349- { "battery discharging 10m 60% bat01" }
350+ "battery discharging 10m 60% bat01 1",
351+ { "battery discharging 10m 60% bat01 1" }
352 },
353 {
354 "merge two discharging batteries",
355- "battery discharging 20m 70% nopath",
356- { "battery discharging 10m 60% bat01", "battery discharging 20m 80% bat02" }
357+ "battery discharging 20m 70% nopath 1",
358+ { "battery discharging 10m 60% bat01 1", "battery discharging 20m 80% bat02 1" }
359 },
360 {
361 "merge two other discharging batteries",
362- "battery discharging 30m 90% nopath",
363- { "battery discharging 20m 80% bat01", "battery discharging 30m 100% bat02" }
364+ "battery discharging 30m 90% nopath 1",
365+ { "battery discharging 20m 80% bat01 1", "battery discharging 30m 100% bat02 1" }
366 },
367 {
368 "merge three discharging batteries",
369- "battery discharging 30m 80% nopath",
370- { "battery discharging 10m 60% bat01", "battery discharging 20m 80% bat02", "battery discharging 30m 100% bat03" }
371+ "battery discharging 30m 80% nopath 1",
372+ { "battery discharging 10m 60% bat01 1", "battery discharging 20m 80% bat02 1", "battery discharging 30m 100% bat03 1" }
373 },
374 {
375 "one charging battery",
376- "battery charging 10m 60% bat01",
377- { "battery charging 10m 60% bat01" }
378+ "battery charging 10m 60% bat01 1",
379+ { "battery charging 10m 60% bat01 1" }
380 },
381 {
382 "merge two charging batteries",
383- "battery charging 20m 70% nopath",
384- { "battery charging 10m 60% bat01", "battery charging 20m 80% bat02" }
385+ "battery charging 20m 70% nopath 1",
386+ { "battery charging 10m 60% bat01 1", "battery charging 20m 80% bat02 1" }
387 },
388 {
389 "merge two other charging batteries",
390- "battery charging 30m 90% nopath",
391- { "battery charging 20m 80% bat01", "battery charging 30m 100% bat02" }
392+ "battery charging 30m 90% nopath 1",
393+ { "battery charging 20m 80% bat01 1", "battery charging 30m 100% bat02 1" }
394 },
395 {
396 "merge three charging batteries",
397- "battery charging 30m 80% nopath",
398- { "battery charging 10m 60% bat01", "battery charging 20m 80% bat02", "battery charging 30m 100% bat03" }
399+ "battery charging 30m 80% nopath 1",
400+ { "battery charging 10m 60% bat01 1", "battery charging 20m 80% bat02 1", "battery charging 30m 100% bat03 1" }
401 },
402 {
403 "one charged battery",
404- "battery charged 0m 100% bat01",
405- { "battery charged 0m 100% bat01" }
406+ "battery charged 0m 100% bat01 1",
407+ { "battery charged 0m 100% bat01 1" }
408 },
409 {
410 "merge one charged, one discharging",
411- "battery discharging 10m 80% nopath",
412- { "battery charged 0m 100% bat01", "battery discharging 10m 60% bat02" }
413+ "battery discharging 10m 80% nopath 1",
414+ { "battery charged 0m 100% bat01 1", "battery discharging 10m 60% bat02 1" }
415 },
416 {
417 "merged one charged, one charging",
418- "battery charging 10m 80% nopath",
419- { "battery charged 0m 100% bat01", "battery charging 10m 60% bat02" }
420+ "battery charging 10m 80% nopath 1",
421+ { "battery charged 0m 100% bat01 1", "battery charging 10m 60% bat02 1" }
422 },
423 {
424 "merged one charged, one charging, one discharging",
425- "battery discharging 10m 74% nopath",
426- { "battery charged 0m 100% bat01", "battery charging 10m 60% bat02", "battery discharging 10m 60% bat03" }
427- },
428- {
429- "one discharging mouse and one discharging battery. pick the one with the least time left",
430- "battery discharging 10m 60% bat01",
431- { "battery discharging 10m 60% bat01", "mouse discharging 20m 80% mouse01" }
432- },
433- {
434- "one discharging mouse and a different discharging battery. pick the one with the least time left",
435- "mouse discharging 20m 80% mouse01",
436- { "battery discharging 30m 100% bat01", "mouse discharging 20m 80% mouse01" }
437+ "battery discharging 10m 74% nopath 1",
438+ { "battery charged 0m 100% bat01 1", "battery charging 10m 60% bat02 1", "battery discharging 10m 60% bat03 1" }
439+ },
440+ {
441+ "one discharging mouse and one discharging battery. ignore mouse because it doesn't supply the power",
442+ "battery discharging 10m 60% bat01 1",
443+ { "battery discharging 10m 60% bat01 1", "mouse discharging 20m 80% mouse01 0" }
444+ },
445+ {
446+ "one discharging mouse and a different discharging battery. ignore mouse because it doesn't supply the power",
447+ "battery discharging 30m 100% bat01 1",
448+ { "battery discharging 30m 100% bat01 1", "mouse discharging 20m 80% mouse01 0" }
449 },
450 {
451 "everything comes before power lines #1",
452- "battery discharging 10m 60% bat01",
453- { "battery discharging 10m 60% bat01", "line-power unknown 0m 0% lp01" }
454- },
455- {
456- "everything comes before power lines #2",
457- "battery charging 10m 60% bat01",
458- { "battery charging 10m 60% bat01", "line-power unknown 0m 0% lp01" }
459- },
460- {
461- "everything comes before power lines #2",
462- "mouse discharging 20m 80% mouse01",
463- { "mouse discharging 20m 80% mouse01", "line-power unknown 0m 0% lp01" }
464+ "battery discharging 10m 60% bat01 1",
465+ { "battery discharging 10m 60% bat01 1", "line-power unknown 0m 0% lp01 1" }
466+ },
467+ {
468+ "everything comes before power lines #2",
469+ "battery charging 10m 60% bat01 1",
470+ { "battery charging 10m 60% bat01 1", "line-power unknown 0m 0% lp01 1" }
471+ },
472+ {
473+ "everything comes before power lines #3 except that the mouse doesn't supply the power",
474+ "line-power unknown 0m 0% lp01 1",
475+ { "mouse discharging 20m 80% mouse01 0", "line-power unknown 0m 0% lp01 1" }
476 },
477 {
478 // https://bugs.launchpad.net/ubuntu/+source/indicator-power/+bug/1470080/comments/10
479 "don't select a device with unknown state when we have another device with a known state...",
480- "battery charged 0m 100% bat01",
481- { "battery charged 0m 100% bat01", "phone unknown 0m 61% phone01" }
482+ "battery charged 0m 100% bat01 1",
483+ { "battery charged 0m 100% bat01 1", "phone unknown 0m 61% phone01 1" }
484 },
485 {
486 // https://bugs.launchpad.net/ubuntu/+source/indicator-power/+bug/1470080/comments/10
487 "...but do select the unknown state device if nothing else is available",
488- "phone unknown 0m 61% phone01",
489- { "phone unknown 0m 61% phone01" }
490+ "phone unknown 0m 61% phone01 1",
491+ { "phone unknown 0m 61% phone01 1" }
492 }
493 };
494
495
496=== modified file 'tests/test-notify.cc'
497--- tests/test-notify.cc 2016-05-16 17:59:03 +0000
498+++ tests/test-notify.cc 2017-01-05 04:40:17 +0000
499@@ -235,7 +235,8 @@
500 UP_DEVICE_KIND_BATTERY,
501 50.0,
502 UP_DEVICE_STATE_DISCHARGING,
503- 30);
504+ 30,
505+ TRUE);
506
507 // confirm that the power levels trigger at the right percentages
508 for (int i=100; i>=0; --i)
509@@ -313,7 +314,8 @@
510 UP_DEVICE_KIND_BATTERY,
511 50.0,
512 UP_DEVICE_STATE_DISCHARGING,
513- 30);
514+ 30,
515+ TRUE);
516
517 // set up a notifier and give it the battery so changing the battery's
518 // charge should show up on the bus.
519@@ -385,7 +387,8 @@
520 UP_DEVICE_KIND_BATTERY,
521 percent_low + 1.0,
522 UP_DEVICE_STATE_DISCHARGING,
523- 30);
524+ 30,
525+ TRUE);
526
527 // the file we expect to play on a low battery notification...
528 const char* expected_file = XDG_DATA_HOME "/" GETTEXT_PACKAGE "/sounds/" LOW_BATTERY_SOUND;

Subscribers

People subscribed via source and target branches