5
5
# under the terms of the GNU General Public License version 3, as published
6
6
# by the Free Software Foundation.
8
from gi.repository import Gio
8
from autopilot.matchers import Eventually
9
from gi.repository import Gio, GLib
10
from testtools.matchers import Equals
10
11
from ubuntu_system_settings.tests import UbuntuSystemSettingsTestCase
11
from unittest import skip
13
13
""" Tests for Ubuntu System Settings """
20
20
super(MainTestCase, self).setUp()
22
@skip("skipped due to rotation lock being hidden")
23
22
def test_enable_rotation_lock(self):
24
23
gsettings = Gio.Settings.new('com.ubuntu.touch.system')
25
current = gsettings.get_value('orientation-lock')
24
current = gsettings.get_value('rotation-lock').get_boolean()
28
self.set_orientation, gsettings, current)
27
self.set_orientation, gsettings, GLib.Variant('b', current))
30
29
self.system_settings.main_view.disable_orientation_lock()
31
30
self.system_settings.main_view.enable_orientation_lock()
37
We cannot determine what the system will set this value to.
38
We can just check that it was not set to an empty string, undefined
42
gsettings.get_value('orientation-lock').get_string(),
43
['', 'none', 'undefined'])
45
@skip("skipped due to rotation lock being hidden")
33
lambda: gsettings.get_value('rotation-lock').get_boolean(),
34
Eventually(Equals(True)))
46
36
def test_disable_rotation_lock(self):
47
37
gsettings = Gio.Settings.new('com.ubuntu.touch.system')
48
current = gsettings.get_value('orientation-lock')
38
current = gsettings.get_value('rotation-lock').get_boolean()
51
self.set_orientation, gsettings, current)
41
self.set_orientation, gsettings, GLib.Variant('b', current))
53
43
self.system_settings.main_view.enable_orientation_lock()
54
44
self.system_settings.main_view.disable_orientation_lock()
60
gsettings.get_value('orientation-lock').get_string(),
47
lambda: gsettings.get_value('rotation-lock').get_boolean(),
48
Eventually(Equals(False)))