diff options
author | Bastien Nocera <hadess@hadess.net> | 2018-04-18 17:42:17 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2018-04-19 03:40:40 +0200 |
commit | 096121740f7a1c9c1e23915505536021245829f1 (patch) | |
tree | 0061883b3b15847276ef92820b5990e6ecf02f37 | |
parent | e7de44f0d53bd509e7d5fcc84512d5398afe64aa (diff) | |
download | upower-096121740f7a1c9c1e23915505536021245829f1.tar.gz |
linux: Add a test for Logitech HID++ charging states
The current power_supply support in the kernel will advertise an unknown
capacity when a device is being charged. This tests this state as well
as the expected behaviour when the device is fully charged.
https://bugs.freedesktop.org/show_bug.cgi?id=97484
-rwxr-xr-x | src/linux/integration-test | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/linux/integration-test b/src/linux/integration-test index 81064dd..cc65a34 100755 --- a/src/linux/integration-test +++ b/src/linux/integration-test @@ -1166,6 +1166,24 @@ class Tests(dbusmock.DBusTestCase): self.assertEqual(self.get_dbus_dev_property(mousebat0_up, 'Percentage'), 55) self.assertEqual(self.get_dbus_dev_property(mousebat0_up, 'BatteryLevel'), UP_DEVICE_LEVEL_NORMAL) + self.testbed.set_attribute(dev, 'capacity_level', 'Unknown\n') + self.testbed.set_attribute(dev, 'status', 'Charging\n') + self.testbed.uevent(dev, 'change') + time.sleep(0.5) + self.assertEqual(self.get_dbus_dev_property(mousebat0_up, 'Percentage'), 50.0) + self.assertEqual(self.get_dbus_dev_property(mousebat0_up, 'BatteryLevel'), UP_DEVICE_LEVEL_UNKNOWN) + self.assertEqual(self.get_dbus_dev_property(mousebat0_up, 'State'), UP_DEVICE_STATE_CHARGING) + self.assertEqual(self.get_dbus_dev_property(mousebat0_up, 'IconName'), 'battery-good-charging-symbolic') + + self.testbed.set_attribute(dev, 'capacity_level', 'Full\n') + self.testbed.set_attribute(dev, 'status', 'Full\n') + self.testbed.uevent(dev, 'change') + time.sleep(0.5) + self.assertEqual(self.get_dbus_dev_property(mousebat0_up, 'Percentage'), 100) + self.assertEqual(self.get_dbus_dev_property(mousebat0_up, 'BatteryLevel'), UP_DEVICE_LEVEL_FULL) + self.assertEqual(self.get_dbus_dev_property(mousebat0_up, 'State'), UP_DEVICE_STATE_FULLY_CHARGED) + self.assertEqual(self.get_dbus_dev_property(mousebat0_up, 'IconName'), 'battery-full-charged-symbolic') + self.stop_daemon() def test_bluetooth_hid_mouse(self): |