Merge lp:~ken-vandine/ubuntu-system-settings/dim-timeout-1437510 into lp:ubuntu-system-settings

Proposed by Ken VanDine
Status: Merged
Approved by: Sebastien Bacher
Approved revision: 1389
Merged at revision: 1422
Proposed branch: lp:~ken-vandine/ubuntu-system-settings/dim-timeout-1437510
Merge into: lp:ubuntu-system-settings
Diff against target: 63 lines (+18/-1)
2 files modified
plugins/battery/SleepValues.qml (+5/-1)
tests/autopilot/ubuntu_system_settings/tests/test_security.py (+13/-0)
To merge this branch: bzr merge lp:~ken-vandine/ubuntu-system-settings/dim-timeout-1437510
Reviewer Review Type Date Requested Status
Sebastien Bacher (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+256685@code.launchpad.net

Commit message

Ensure dim-timeout is 10 seconds less than activity-timeout

Description of the change

Ensure dim-timeout is 10 seconds less than activity-timeout

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks Ken, that looks fine as a workaround, as you wrote on the bug ideally the system would do that for us. Not sure about the minimum value, we could just ensure it's > 10 as well, but I don't think it really makes a difference either way

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/battery/SleepValues.qml'
--- plugins/battery/SleepValues.qml 2015-01-30 18:09:06 +0000
+++ plugins/battery/SleepValues.qml 2015-04-17 15:26:50 +0000
@@ -45,12 +45,16 @@
45 id: powerSettings45 id: powerSettings
46 schema.id: usePowerd ? "com.ubuntu.touch.system" : "org.gnome.desktop.session"46 schema.id: usePowerd ? "com.ubuntu.touch.system" : "org.gnome.desktop.session"
47 onChanged: {47 onChanged: {
48 if (key == "activityTimeout" || key == "idleDelay")48 if (key == "activityTimeout" || key == "idleDelay") {
49 var curIndex = idleValues.indexOf(value)49 var curIndex = idleValues.indexOf(value)
50 if( curIndex != -1)50 if( curIndex != -1)
51 sleepSelector.selectedIndex = curIndex51 sleepSelector.selectedIndex = curIndex
52 else if(value === 0)52 else if(value === 0)
53 sleepSelector.selectedIndex = 653 sleepSelector.selectedIndex = 6
54 // ensure dimTimeout is 10 seconds less than activityTimeout
55 if (usePowerd)
56 dimTimeout = Math.max(activityTimeout - 10, 50)
57 }
54 }58 }
55 Component.onCompleted: {59 Component.onCompleted: {
56 if (usePowerd)60 if (usePowerd)
5761
=== modified file 'tests/autopilot/ubuntu_system_settings/tests/test_security.py'
--- tests/autopilot/ubuntu_system_settings/tests/test_security.py 2015-02-19 15:18:09 +0000
+++ tests/autopilot/ubuntu_system_settings/tests/test_security.py 2015-04-17 15:26:50 +0000
@@ -62,6 +62,14 @@
62 prev = gsettings.get_uint('idle-delay')62 prev = gsettings.get_uint('idle-delay')
63 return prev63 return prev
6464
65 def _get_dim_timeout(self):
66 if self.use_powerd:
67 gsettings = Gio.Settings.new('com.ubuntu.touch.system')
68 prev = gsettings.get_uint('dim-timeout')
69 return prev
70 else:
71 return None
72
65 def _go_to_phone_lock(self):73 def _go_to_phone_lock(self):
66 selector = self.security_page.select_single(74 selector = self.security_page.select_single(
67 objectName='lockingControl'75 objectName='lockingControl'
@@ -112,6 +120,7 @@
112120
113 def test_locking_control_value(self):121 def test_locking_control_value(self):
114 actTimeout = self._get_activity_timeout()122 actTimeout = self._get_activity_timeout()
123 dimTimeout = self._get_dim_timeout()
115 activityTimeout = self.security_page.select_single(124 activityTimeout = self.security_page.select_single(
116 objectName='lockingControl').value125 objectName='lockingControl').value
117 if actTimeout is 0:126 if actTimeout is 0:
@@ -120,10 +129,14 @@
120 self.assertEquals(129 self.assertEquals(
121 activityTimeout,130 activityTimeout,
122 ('After {:d} minute').format(int(actTimeout/60)))131 ('After {:d} minute').format(int(actTimeout/60)))
132 if dimTimeout:
133 self.assertEquals(dimTimeout, actTimeout - 10)
123 else:134 else:
124 self.assertEquals(135 self.assertEquals(
125 activityTimeout,136 activityTimeout,
126 ('After {:d} minutes').format(int(actTimeout/60)))137 ('After {:d} minutes').format(int(actTimeout/60)))
138 if dimTimeout:
139 self.assertEquals(dimTimeout, actTimeout - 10)
127140
128 def test_phone_lock_page(self):141 def test_phone_lock_page(self):
129 self._go_to_phone_lock()142 self._go_to_phone_lock()

Subscribers

People subscribed via source and target branches