[gnome-settings-daemon] power: Add test for IDLETIME reset on resume



commit 2b70843dc71fd9423771abf5d1595460907f4c65
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Jan 22 10:31:10 2013 +0100

    power: Add test for IDLETIME reset on resume
    
    As fixed in b0d101d878482914c1ba652abf413b362dd4eaa8

 plugins/power/test.py |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/plugins/power/test.py b/plugins/power/test.py
index 687ab7a..0b7c967 100755
--- a/plugins/power/test.py
+++ b/plugins/power/test.py
@@ -234,6 +234,29 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
         time.sleep(5)
         self.assertEqual(dbus_props.Get('org.gnome.SessionManager.Presence', 'status'), gsdpowerenums.GSM_PRESENCE_STATUS_IDLE)
 
+    def test_idle_time_reset_on_resume(self):
+        '''Check that the IDLETIME is reset when resuming'''
+
+        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)
+
+        # Go idle
+        self.settings_session['idle-delay'] = 5
+        time.sleep(7)
+        self.assertEqual(dbus_props.Get('org.gnome.SessionManager.Presence', 'status'), gsdpowerenums.GSM_PRESENCE_STATUS_IDLE)
+
+        # Go to sleep
+        self.obj_logind.EmitSignal('', 'PrepareForSleep', 'b', [True], dbus_interface='org.freedesktop.DBus.Mock')
+        time.sleep(1)
+
+        # Wake up
+        self.obj_logind.EmitSignal('', 'PrepareForSleep', 'b', [False], dbus_interface='org.freedesktop.DBus.Mock')
+        time.sleep(1)
+
+        # And check we're not idle
+        self.assertEqual(dbus_props.Get('org.gnome.SessionManager.Presence', 'status'), gsdpowerenums.GSM_PRESENCE_STATUS_AVAILABLE)
+
     def test_sleep_inactive_battery(self):
         '''sleep-inactive-battery-timeout'''
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]