[gnome-settings-daemon] power: Fix failing tests when the mock brightness isn't set



commit e4d551d941132d7cc1c3a96c7dc3cc7240917fe8
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Apr 26 17:17:39 2013 +0200

    power: Fix failing tests when the mock brightness isn't set
    
    If we try to read the default brightness and the file is missing
    it's probably because we didn't change it.

 plugins/power/test.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/plugins/power/test.py b/plugins/power/test.py
index 7ef565d..3b261ac 100755
--- a/plugins/power/test.py
+++ b/plugins/power/test.py
@@ -169,7 +169,10 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
         return self.obj_session_presence_props.Get('org.gnome.SessionManager.Presence', 'status')
 
     def get_brightness(self):
-        (success, ret) = GLib.file_get_contents ('GSD_MOCK_brightness')
+        try:
+            (success, ret) = GLib.file_get_contents ('GSD_MOCK_brightness')
+        except:
+            return gsdpowerconstants.GSD_MOCK_DEFAULT_BRIGHTNESS
         return int(ret)
 
     def set_has_external_monitor(self, external):


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