summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoão Paulo Rechi Vita <jprvita@endlessm.com>2018-11-02 16:55:22 (GMT)
committerJoão Paulo Rechi Vita <jprvita@endlessm.com>2018-11-14 20:57:15 (GMT)
commitf3f4c6e0b4d05b541a87f09bd93f70a487258884 (patch)
tree8302cc643901274364e55e72f6071bc72f444d15
parenteb0282701501b51293a7ef56198cb8ecef725b24 (diff)
downloadupower-f3f4c6e0b4d05b541a87f09bd93f70a487258884.tar.gz
integration-test: Test DisplayDevice pending-charge
Test relaying the pending-charge state to the DisplayDevice. This commit adds three tests: only one battery pending-charge, one battery pending-charge and another one discharging, and one battery pending-charge and another one charging.
-rwxr-xr-xsrc/linux/integration-test72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/linux/integration-test b/src/linux/integration-test
index 7f36ca6..a81528f 100755
--- a/src/linux/integration-test
+++ b/src/linux/integration-test
@@ -525,6 +525,78 @@ class Tests(dbusmock.DBusTestCase):
self.assertEqual(self.get_dbus_display_property('WarningLevel'), UP_DEVICE_LEVEL_NONE)
self.stop_daemon()
+ def test_display_pending_charge_one_battery(self):
+ '''One battery pending-charge'''
+
+ self.testbed.add_device('power_supply', 'BAT0', None,
+ ['type', 'Battery',
+ 'present', '1',
+ 'status', 'Not charging',
+ 'charge_full', '10500000',
+ 'charge_full_design', '11000000',
+ 'capacity', '40',
+ 'voltage_now', '12000000'], [])
+
+ self.start_daemon()
+ devs = self.proxy.EnumerateDevices()
+ self.assertEqual(len(devs), 1)
+ self.assertEqual(self.get_dbus_display_property('State'), UP_DEVICE_STATE_PENDING_CHARGE)
+ self.stop_daemon()
+
+ def test_display_pending_charge_other_battery_discharging(self):
+ '''One battery pending-charge and another one discharging'''
+
+ self.testbed.add_device('power_supply', 'BAT0', None,
+ ['type', 'Battery',
+ 'present', '1',
+ 'status', 'Not charging',
+ 'charge_full', '10500000',
+ 'charge_full_design', '11000000',
+ 'capacity', '40',
+ 'voltage_now', '12000000'], [])
+ self.testbed.add_device('power_supply', 'BAT1', None,
+ ['type', 'Battery',
+ 'present', '1',
+ 'status', 'Discharging',
+ 'charge_full', '10500000',
+ 'charge_full_design', '11000000',
+ 'capacity', '40',
+ 'voltage_now', '12000000'], [])
+
+
+ self.start_daemon()
+ devs = self.proxy.EnumerateDevices()
+ self.assertEqual(len(devs), 2)
+ self.assertEqual(self.get_dbus_display_property('State'), UP_DEVICE_STATE_DISCHARGING)
+ self.stop_daemon()
+
+ def test_display_pending_charge_other_battery_charging(self):
+ '''One battery pending-charge and another one charging'''
+
+ self.testbed.add_device('power_supply', 'BAT0', None,
+ ['type', 'Battery',
+ 'present', '1',
+ 'status', 'Not charging',
+ 'charge_full', '10500000',
+ 'charge_full_design', '11000000',
+ 'capacity', '40',
+ 'voltage_now', '12000000'], [])
+ self.testbed.add_device('power_supply', 'BAT1', None,
+ ['type', 'Battery',
+ 'present', '1',
+ 'status', 'Charging',
+ 'charge_full', '10500000',
+ 'charge_full_design', '11000000',
+ 'capacity', '40',
+ 'voltage_now', '12000000'], [])
+
+
+ self.start_daemon()
+ devs = self.proxy.EnumerateDevices()
+ self.assertEqual(len(devs), 2)
+ self.assertEqual(self.get_dbus_display_property('State'), UP_DEVICE_STATE_CHARGING)
+ self.stop_daemon()
+
def test_battery_charge(self):
'''battery which reports charge instead of energy