[gnome-settings-daemon/wip/benzea/backlight] power: Add test to check backlight brightness is updated after uevent
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/wip/benzea/backlight] power: Add test to check backlight brightness is updated after uevent
- Date: Fri, 20 Apr 2018 17:17:40 +0000 (UTC)
commit 8b7e7d184395163b08cf95dccfa08c45981bb751
Author: Benjamin Berg <bberg redhat com>
Date: Fri Apr 20 19:16:29 2018 +0200
power: Add test to check backlight brightness is updated after uevent
A simple test to check that gsd-power will notice an update to the
brightness.
plugins/power/gsd-backlight.c | 1 +
plugins/power/test.py | 18 ++++++++++++++++++
2 files changed, 19 insertions(+)
---
diff --git a/plugins/power/gsd-backlight.c b/plugins/power/gsd-backlight.c
index 3193c3f8..ce5fb927 100644
--- a/plugins/power/gsd-backlight.c
+++ b/plugins/power/gsd-backlight.c
@@ -165,6 +165,7 @@ gsd_backlight_udev_idle_update_cb (GsdBacklight *backlight)
return FALSE;
}
brightness = atoi(contents);
+ g_debug ("GsdBacklight: New brightness value after uevent is %d", brightness);
/* Only notify if brightness has changed. */
if (brightness == priv->brightness_val)
diff --git a/plugins/power/test.py b/plugins/power/test.py
index 9c13a7f2..c039b0fb 100755
--- a/plugins/power/test.py
+++ b/plugins/power/test.py
@@ -1051,6 +1051,24 @@ 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.check_plugin_log('GsdBacklight: New brightness value after uevent is 81', 1, 'gsd-power did not
process uevent correctly')
+
+ 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.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]