[gnome-settings-daemon] power: Add tests for blanking on lid close
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] power: Add tests for blanking on lid close
- Date: Wed, 23 Jan 2013 18:21:59 +0000 (UTC)
commit 09c87dbaae882ee7225fcc9052ebcd6a07c695a1
Author: Bastien Nocera <hadess hadess net>
Date: Wed Jan 23 18:44:12 2013 +0100
power: Add tests for blanking on lid close
For details see bug 692282
plugins/power/test.py | 67 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 67 insertions(+), 0 deletions(-)
---
diff --git a/plugins/power/test.py b/plugins/power/test.py
index a09e75d..9ad59f8 100755
--- a/plugins/power/test.py
+++ b/plugins/power/test.py
@@ -334,6 +334,73 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
self.obj_session_mgr.Uninhibit(dbus.UInt32(inhibit_id))
+ def test_lock_on_lid_close(self):
+ '''Check that we do lock on lid closing, if the machine will not suspend'''
+
+ self.settings_screensaver['lock-enabled'] = True
+
+ # create inhibitor
+ inhibit_id = self.obj_session_mgr.Inhibit(
+ 'testsuite', dbus.UInt32(0), 'for testing',
+ dbus.UInt32(gsdpowerenums.GSM_INHIBITOR_FLAG_SUSPEND))
+
+ # Close the lid
+ self.obj_upower.Set('org.freedesktop.UPower', 'LidIsClosed', True)
+ self.obj_upower.EmitSignal('', 'Changed', '', [], dbus_interface='org.freedesktop.DBus.Mock')
+
+ # Check that we've blanked
+ time.sleep(2)
+ self.assertTrue(self.obj_screensaver.GetActive(), 'screensaver not turned on')
+ self.check_blank(2)
+
+ # Drop the inhibit and see whether we suspend
+ self.obj_session_mgr.Uninhibit(dbus.UInt32(inhibit_id))
+ self.check_for_suspend(5)
+
+ def test_blank_on_lid_close(self):
+ '''Check that we do blank on lid closing, if the machine will not suspend'''
+
+ # create inhibitor
+ inhibit_id = self.obj_session_mgr.Inhibit(
+ 'testsuite', dbus.UInt32(0), 'for testing',
+ dbus.UInt32(gsdpowerenums.GSM_INHIBITOR_FLAG_SUSPEND))
+
+ # Close the lid
+ self.obj_upower.Set('org.freedesktop.UPower', 'LidIsClosed', True)
+ self.obj_upower.EmitSignal('', 'Changed', '', [], dbus_interface='org.freedesktop.DBus.Mock')
+
+ # Check that we've blanked
+ self.check_blank(4)
+
+ # Drop the inhibit and see whether we suspend
+ self.obj_session_mgr.Uninhibit(dbus.UInt32(inhibit_id))
+ self.check_for_suspend(5)
+
+ def test_unblank_on_lid_open(self):
+ '''Check that we do unblank on lid opening, if the machine will not suspend'''
+
+ # create inhibitor
+ inhibit_id = self.obj_session_mgr.Inhibit(
+ 'testsuite', dbus.UInt32(0), 'for testing',
+ dbus.UInt32(gsdpowerenums.GSM_INHIBITOR_FLAG_SUSPEND))
+
+ # Close the lid
+ self.obj_upower.Set('org.freedesktop.UPower', 'LidIsClosed', True)
+ self.obj_upower.EmitSignal('', 'Changed', '', [], dbus_interface='org.freedesktop.DBus.Mock')
+
+ # Check that we've blanked
+ self.check_blank(2)
+
+ # Reopen the lid
+ self.obj_upower.Set('org.freedesktop.UPower', 'LidIsClosed', False)
+ self.obj_upower.EmitSignal('', 'Changed', '', [], dbus_interface='org.freedesktop.DBus.Mock')
+
+ # Check for unblanking
+ self.check_unblank(2)
+
+ # Drop the inhibit
+ self.obj_session_mgr.Uninhibit(dbus.UInt32(inhibit_id))
+
def test_dim(self):
'''Check that we do go to dim'''
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]