forked from phanimahesh/unity-revamp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
unityunittests.py
111 lines (97 loc) · 3.9 KB
/
unityunittests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Authors:
# J Phani Mahesh <phanimahesh@gmail.com>
# Barneedhar (jokerdino) <barneedhar@ubuntu.com>
# Amith KK <amithkumaran@gmail.com>
#
# Description:
# Unit tests for unity reset.
import unittest
import unityreset
Gio=unityreset.Gio
class TestUnityReset(unittest.TestCase):
'''Unittest for unity --reset'''
def setUp(self):
# Get defaults
self.compizPlugins=unityreset.UnityReset.snapshotCompizPlugins()
self.compizChildren=unityreset.UnityReset.snapshotCompizChildren()
self.unityChildren=unityreset.UnityReset.snapshotUnityChildren()
def test_show_hud(self):
schema="org.compiz.integrated"
key="show-hud"
default=self.compizChildren[schema][key]
gsettings=Gio.Settings(schema)
gsettings.set_strv(key,['<Super>','<Ctrl>'])
unityreset.UnityReset(False)
current=gsettings.get_value(key)
self.assertTrue(current==default)
def test_reset_display_recent_apps(self):
schema="com.canonical.Unity.ApplicationsLens"
key="display-recent-apps"
default=self.unityChildren[schema][key]
gsettings=Gio.Settings(schema)
gsettings.set_boolean(key,False)
unityreset.UnityReset(False)
current=gsettings.get_value(key)
self.assertTrue(current==default)
def test_home_lens_ordering(self):
schema="com.canonical.Unity.Dash"
key="home-lens-ordering"
default=self.unityChildren[schema][key]
gsettings=Gio.Settings(schema)
gsettings.set_strv(key,['video.lens','music.lens'])
unityreset.UnityReset(False)
current=gsettings.get_value(key)
self.assertTrue(current==default)
def test_dash_form_factoring(self):
schema="com.canonical.Unity"
key="form-factor"
default=self.unityChildren[schema][key]
gsettings=Gio.Settings(schema)
gsettings.set_string(key,"Desktop")
unityreset.UnityReset(False)
current=gsettings.get_value(key)
self.assertTrue(current==default)
def test_reset_compiz_scale(self):
schema="org.compiz.scale"
key="opacity"
path="/org/compiz/profiles/unity/plugins/scale/"
default=self.compizPlugins[schema][key]
gsettings=Gio.Settings(schema,path)
gsettings.set_int(key,49)
unityreset.UnityReset(False)
current=gsettings.get_value(key)
self.assertTrue(current==default)
def test_enabled_compiz_plugins(self):
schema="org.compiz.core"
key="active-plugins"
path="/org/compiz/profiles/unity/plugins/core/"
default=self.compizPlugins[schema][key]
gsettings=Gio.Settings(schema,path)
gsettings.set_strv(key,['core','composite','opengl','compiztoolbox','decor','vpswitch','snap','mousepoll','resize','place','move','wall','grid','regex','imgpng','session','gnomecompat','animation','fade','unitymtgrabhandles','workarounds','scale','unityshell'])
unityreset.UnityReset(False)
current=gsettings.get_value(key)
self.assertTrue(current==default)
def test_runner_history(self):
schema="com.canonical.Unity.Runner"
key="history"
default=self.unityChildren[schema][key]
gsettings=Gio.Settings(schema)
gsettings.set_strv(key,['abc','def'])
unityreset.UnityReset(False)
current=gsettings.get_value(key)
self.assertTrue(current==default)
def test_launcher_hide_mode(self):
schema="org.compiz.unityshell"
key="launcher-hide-mode"
path="/org/compiz/profiles/unity/plugins/unityshell/"
default=self.compizPlugins[schema][key]
gsettings=Gio.Settings(schema,path)
gsettings.set_int(key,1)
unityreset.UnityReset(False)
current=gsettings.get_value(key)
self.assertTrue(current==default)
if __name__ == '__main__':
unittest.main()