diff options
author | Martin Pitt <martinpitt@gnome.org> | 2013-08-21 18:11:52 +0200 |
---|---|---|
committer | Martin Pitt <martinpitt@gnome.org> | 2013-08-29 10:44:26 +0200 |
commit | 2b10e202626332713583122010160b709b77acbc (patch) | |
tree | 6760c431deecb4d654895174cc9981a1a50093d1 /libupower-glib/up-device.c | |
parent | 470bc1150b67d1b6052dd00bebd4ae6a8a3f12c5 (diff) |
Make GetHistory() array order consistent
When requesting fewer history elements than we actually have, fix the
interpolation loop to not reverse the returned elements; this already does not
happen if we request more elements than available, which led to the returned
list order depending on the history size.
Now the first array element is always the most recent one. Update documentation
accordingly.
Add test case to reproduce the problem. We now add three sample points to be
able to request a subset and still assert its correct order, and make the
charge values be further apart to ensure correct interpolation.
https://bugs.freedesktop.org/show_bug.cgi?id=68384
Diffstat (limited to 'libupower-glib/up-device.c')
-rw-r--r-- | libupower-glib/up-device.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libupower-glib/up-device.c b/libupower-glib/up-device.c index 8b66bde..b8768d8 100644 --- a/libupower-glib/up-device.c +++ b/libupower-glib/up-device.c @@ -592,7 +592,9 @@ out: * * Gets the device history. * - * Return value: (transfer full): an array of #UpHistoryItem's, else #NULL and @error is used + * Return value: (transfer full): an array of #UpHistoryItem's, with the most + * recent one being first; %NULL if @error is set or @device is + * invalid * * Since: 0.9.0 **/ |