diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2014-10-15 02:45:50 +0000 |
---|---|---|
committer | CI bot <ps-jenkins@lists.canonical.com> | 2014-10-15 02:45:50 +0000 |
commit | 24966789fc551c90857a848cebae75917fa9cc2d (patch) | |
tree | 30fae10e06f643d665a9ff88e9f47f3da63faf45 /tests/manual | |
parent | 7251f3df13dc2503791fc7d1b485a48636a15884 (diff) | |
parent | ee53f5d18009dba3cf69ddb2e2135ae2197c43b2 (diff) | |
download | ayatana-indicator-power-24966789fc551c90857a848cebae75917fa9cc2d.tar.gz ayatana-indicator-power-24966789fc551c90857a848cebae75917fa9cc2d.tar.bz2 ayatana-indicator-power-24966789fc551c90857a848cebae75917fa9cc2d.zip |
Add mock battery support to make QA testing easier. Fixes: 1373511
Approved by: Antti Kaijanmäki, PS Jenkins bot, Ted Gould
Diffstat (limited to 'tests/manual')
-rw-r--r-- | tests/manual | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/tests/manual b/tests/manual index 1ec1524..1e6febd 100644 --- a/tests/manual +++ b/tests/manual @@ -1,21 +1,37 @@ Notes on Battery Testing -When building from source, an executable 'indicator-power-service-cmdline-battery' will be built in the tests/ directory. This has the same code as indicator-power-service, except instead of listening to UPower it has a single fake battery that can be set from the command line to set its charge level and whether it's charging or discharging. +Mock battery propreties are available for testing purposes. -You'll need to stop the current indicator-power-service before starting the test one. After that, you enter in a number, or 'charging', or 'discharging', to set the fake battery. ctrl-c exits. +The testing properties are DBus properties published on busname "com.canonical.indicator.power", object path "/com/canonical/indicator/power/Testing", and interface "com.canonical.indicator.power.Testing". The four properties are "MockBatteryEnabled" (boolean, default false), "MockBatteryLevel" (uint32 [0-100], default 50), "MockBatteryState" (string, default 'discharging'), "MockBatteryMinutesLeft" (minutes remaining to charge/discharge, uint32, default 30). -Example: +Example use: -$ stop indicator-power # stop the real indicator-power service -$ build/tests/indicator-power-service-cmdline-battery # start the test service -50 # sets the fake battery level to 50% -30 # sets the fake battery level to 30% -charging # sets the fake battery to charging -discharging # sets the fake battery to discharging -ctrl-c # exits the test service -$ start indicator-power # restart the real service +Show the testing properties: +$ gdbus call --session --dest "com.canonical.indicator.power" \ + --object-path /com/canonical/indicator/power/Testing \ + --method org.freedesktop.DBus.Properties.GetAll \ + com.canonical.indicator.power.Testing +({'MockBatteryEnabled': <false>, 'MockBatteryLevel': <uint32 50>, 'MockBatteryState': <'discharging'>, 'MockBatteryMinutesLeft': <uint32 30>},) + +Enable the mock battery: + +$ gdbus call --session --dest "com.canonical.indicator.power" \ + --object-path /com/canonical/indicator/power/Testing \ + --method org.freedesktop.DBus.Properties.Set \ + com.canonical.indicator.power.Testing \ + MockBatteryEnabled \ + "<true>" + +Set the mock battery's charge to 10% + +$ gdbus call --session --dest "com.canonical.indicator.power" \ + --object-path /com/canonical/indicator/power/Testing \ + --method org.freedesktop.DBus.Properties.Set \ + com.canonical.indicator.power.Testing \ + MockBatteryLevel \ + "<uint32 10>" Test-case indicator-power/unity7-items-check |