summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Berg <bberg@redhat.com>2018-04-20 19:16:29 +0200
committerBenjamin Berg <bberg@redhat.com>2018-08-03 13:39:47 +0200
commita0e1507d6d7e58a993244c7ac075025eba5289a4 (patch)
tree02280ca41119d0f3736910e6ff8dda35357cebcc
parent27f6068165bd7c3e7d80e8149f44c2bebf5919ad (diff)
downloadgnome-settings-daemon-wip/benzea/backlight.tar.gz
power: Add test to check backlight brightness is updated after ueventwip/benzea/backlight
A simple test to check that gsd-power will notice an update to the brightness.
-rw-r--r--plugins/power/gsd-backlight.c2
-rwxr-xr-xplugins/power/test.py20
2 files changed, 22 insertions, 0 deletions
diff --git a/plugins/power/gsd-backlight.c b/plugins/power/gsd-backlight.c
index 93cfe28a..d2c758d2 100644
--- a/plugins/power/gsd-backlight.c
+++ b/plugins/power/gsd-backlight.c
@@ -197,6 +197,8 @@ gsd_backlight_udev_uevent (GUdevClient *client, gchar *action, GUdevDevice *devi
g_udev_device_get_sysfs_path (backlight->udev_device)) != 0)
return;
+ g_debug ("GsdBacklight: Got uevent");
+
gsd_backlight_udev_idle_update (backlight);
}
diff --git a/plugins/power/test.py b/plugins/power/test.py
index 80134239..d9be7597 100755
--- a/plugins/power/test.py
+++ b/plugins/power/test.py
@@ -1121,6 +1121,26 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
time.sleep(1.0)
self.assertEqual(self.get_brightness(), 90)
+ def test_brightness_uevent(self):
+ obj_gsd_power = self.session_bus_con.get_object(
+ 'org.gnome.SettingsDaemon.Power', '/org/gnome/SettingsDaemon/Power')
+ obj_gsd_power_prop_iface = dbus.Interface(obj_gsd_power, dbus.PROPERTIES_IFACE)
+
+ brightness = obj_gsd_power_prop_iface.Get('org.gnome.SettingsDaemon.Power.Screen', 'Brightness')
+ self.assertEqual(50, brightness)
+
+ # Check that the brightness is updated if it was changed through some
+ # other mechanism (e.g. firmware).
+ # Set to 80+1 because of the GSD offset (see add_backlight).
+ self.testbed.set_attribute(self.backlight, 'brightness', '81')
+ self.testbed.uevent(self.backlight, 'change')
+
+ self.check_plugin_log('GsdBacklight: Got uevent', 1, 'gsd-power did not process uevent')
+ time.sleep(0.1)
+
+ brightness = obj_gsd_power_prop_iface.Get('org.gnome.SettingsDaemon.Power.Screen', 'Brightness')
+ self.assertEqual(80, brightness)
+
def test_brightness_step(self):
# We cannot use check_plugin_log here because the startup check already
# read the relevant message.