[gnome-settings-daemon] power: Add test for dimming timeout
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] power: Add test for dimming timeout
- Date: Tue, 22 Jan 2013 11:32:53 +0000 (UTC)
commit 1a6e928940344f1b2aed9d84e5131216185758d8
Author: Bastien Nocera <hadess hadess net>
Date: Tue Jan 22 12:14:53 2013 +0100
power: Add test for dimming timeout
Ensure that we dim after a certain inactivity time.
plugins/power/test.py | 35 +++++++++++++++++++++++++++++++++++
1 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/plugins/power/test.py b/plugins/power/test.py
index a300dfe..8b51e78 100755
--- a/plugins/power/test.py
+++ b/plugins/power/test.py
@@ -148,6 +148,21 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
if log:
self.assertFalse(b' Doing a state transition: dim' in log, 'unexpected dim request')
+ def check_dim(self, timeout):
+ '''Check that mode is set to dim in the given time'''
+
+ # wait for specified time to ensure it didn't do anything
+ while timeout > 0:
+ time.sleep(1)
+ timeout -= 1
+ # check that it requested blank
+ log = self.plugin_log.read()
+
+ if 'Doing a state transition: dim' in log:
+ break
+ else:
+ self.fail('timed out waiting for dim')
+
def check_blank(self, timeout):
'''Check that blank is requested.
@@ -303,6 +318,26 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
self.obj_session_mgr.Uninhibit(dbus.UInt32(inhibit_id))
+ def test_dim(self):
+ '''Check that we do go to dim'''
+
+ idle_delay = round(gsdpowerconstants.MINIMUM_IDLE_DIM_DELAY / gsdpowerconstants.IDLE_DELAY_TO_IDLE_DIM_MULTIPLIER)
+
+ self.settings_session['idle-delay'] = idle_delay
+ self.settings_gsd_power['sleep-inactive-battery-timeout'] = idle_delay + 1
+ self.settings_gsd_power['sleep-inactive-battery-type'] = 'suspend'
+
+ # Check that we're not idle
+ obj_session_presence = self.session_bus_con.get_object(
+ 'org.gnome.SessionManager', '/org/gnome/SessionManager/Presence')
+ dbus_props = dbus.Interface(obj_session_presence, dbus.PROPERTIES_IFACE)
+ self.assertEqual(dbus_props.Get('org.gnome.SessionManager.Presence', 'status'), gsdpowerenums.GSM_PRESENCE_STATUS_AVAILABLE)
+
+ # Wait and check we're not idle, but dimmed
+ self.check_dim(gsdpowerconstants.MINIMUM_IDLE_DIM_DELAY)
+
+ self.assertEqual(dbus_props.Get('org.gnome.SessionManager.Presence', 'status'), gsdpowerenums.GSM_PRESENCE_STATUS_AVAILABLE)
+
def test_action_critical_battery(self):
'''action on critical battery'''
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]