diff options
author | Sebastien Bacher <seb128@ubuntu.com> | 2012-11-14 11:08:13 +0100 |
---|---|---|
committer | Sebastien Bacher <seb128@ubuntu.com> | 2012-11-14 11:08:13 +0100 |
commit | fb0e7bddb26dfa7b9163754269341c1449be821d (patch) | |
tree | 75e79c6dde478060f9db62f908ec66caf8d4cb6f /tests/test-device.cc | |
parent | a3b85f41ef90ad23d9cbc943fd24856d2775cc7a (diff) | |
parent | 17629a4f743c1bbae6f170eeb613bd4e9c4e7978 (diff) | |
download | ayatana-indicator-power-fb0e7bddb26dfa7b9163754269341c1449be821d.tar.gz ayatana-indicator-power-fb0e7bddb26dfa7b9163754269341c1449be821d.tar.bz2 ayatana-indicator-power-fb0e7bddb26dfa7b9163754269341c1449be821d.zip |
Import upstream version 12.10.5
Diffstat (limited to 'tests/test-device.cc')
-rw-r--r-- | tests/test-device.cc | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/tests/test-device.cc b/tests/test-device.cc index 18bdc08..021404f 100644 --- a/tests/test-device.cc +++ b/tests/test-device.cc @@ -555,7 +555,7 @@ TEST_F(DeviceTest, Labels) INDICATOR_POWER_DEVICE_PERCENTAGE, 0.0, INDICATOR_POWER_DEVICE_TIME, guint64(0), NULL); - check_strings (device, "AC Adapter", "AC Adapter", "AC Adapter"); + check_strings (device, "", "AC Adapter", "AC Adapter"); // cleanup g_object_unref(o); @@ -587,19 +587,22 @@ TEST_F(DeviceTest, ChoosePrimary) sorted in order of preference wrt the spec's criteria. So tests[i] should be picked over any test with an index greater than i */ struct { + int kind; int state; guint64 time; double percentage; } tests[] = { - { UP_DEVICE_STATE_DISCHARGING, 49, 50.0 }, - { UP_DEVICE_STATE_DISCHARGING, 50, 50.0 }, - { UP_DEVICE_STATE_DISCHARGING, 50, 100.0 }, - { UP_DEVICE_STATE_DISCHARGING, 51, 50.0 }, - { UP_DEVICE_STATE_CHARGING, 50, 50.0 }, - { UP_DEVICE_STATE_CHARGING, 49, 50.0 }, - { UP_DEVICE_STATE_CHARGING, 49, 100.0 }, - { UP_DEVICE_STATE_CHARGING, 48, 50.0 }, - { UP_DEVICE_STATE_FULLY_CHARGED, 0, 50.0 } + { UP_DEVICE_KIND_BATTERY, UP_DEVICE_STATE_DISCHARGING, 49, 50.0 }, + { UP_DEVICE_KIND_BATTERY, UP_DEVICE_STATE_DISCHARGING, 50, 50.0 }, + { UP_DEVICE_KIND_BATTERY, UP_DEVICE_STATE_DISCHARGING, 50, 100.0 }, + { UP_DEVICE_KIND_BATTERY, UP_DEVICE_STATE_DISCHARGING, 51, 50.0 }, + { UP_DEVICE_KIND_BATTERY, UP_DEVICE_STATE_CHARGING, 50, 50.0 }, + { UP_DEVICE_KIND_BATTERY, UP_DEVICE_STATE_CHARGING, 49, 50.0 }, + { UP_DEVICE_KIND_BATTERY, UP_DEVICE_STATE_CHARGING, 49, 100.0 }, + { UP_DEVICE_KIND_BATTERY, UP_DEVICE_STATE_CHARGING, 48, 50.0 }, + { UP_DEVICE_KIND_BATTERY, UP_DEVICE_STATE_FULLY_CHARGED, 0, 50.0 }, + { UP_DEVICE_KIND_KEYBOARD, UP_DEVICE_STATE_FULLY_CHARGED, 0, 50.0 }, + { UP_DEVICE_KIND_LINE_POWER, UP_DEVICE_STATE_UNKNOWN, 0, 0.0 } }; device_list = NULL; @@ -610,11 +613,13 @@ TEST_F(DeviceTest, ChoosePrimary) { for (int j=i+1; j<n; j++) { - g_object_set (a, INDICATOR_POWER_DEVICE_STATE, tests[i].state, + g_object_set (a, INDICATOR_POWER_DEVICE_KIND, tests[i].kind, + INDICATOR_POWER_DEVICE_STATE, tests[i].state, INDICATOR_POWER_DEVICE_TIME, guint64(tests[i].time), INDICATOR_POWER_DEVICE_PERCENTAGE, tests[i].percentage, NULL); - g_object_set (b, INDICATOR_POWER_DEVICE_STATE, tests[j].state, + g_object_set (b, INDICATOR_POWER_DEVICE_KIND, tests[j].kind, + INDICATOR_POWER_DEVICE_STATE, tests[j].state, INDICATOR_POWER_DEVICE_TIME, guint64(tests[j].time), INDICATOR_POWER_DEVICE_PERCENTAGE, tests[j].percentage, NULL); |