Merge lp:~pedro/mago/gnome-appearance-properties into lp:~mago-contributors/mago/mago-1.0

Proposed by Pedro Villavicencio
Status: Merged
Merged at revision: 144
Proposed branch: lp:~pedro/mago/gnome-appearance-properties
Merge into: lp:~mago-contributors/mago/mago-1.0
Diff against target: 227 lines (+202/-0)
5 files modified
gnome-appearance-properties/README (+21/-0)
gnome-appearance-properties/gnome_appearance_properties.py (+22/-0)
gnome-appearance-properties/gnome_appearance_properties.xml (+35/-0)
mago/application/gnome_appearance_properties.py (+102/-0)
mago/test_suite/gnome_appearance_properties.py (+22/-0)
To merge this branch: bzr merge lp:~pedro/mago/gnome-appearance-properties
Reviewer Review Type Date Requested Status
Jean-Baptiste Lallement Approve
Review via email: mp+41319@code.launchpad.net

Description of the change

Gnome Appearance Properties test cases, what it does right now:
 * Change the GTK+ theme.
 * Change the Window Border theme.
 * Change the Icon theme.
 * Change the Mouse Pointer theme.

It needs to be extended to support more things like: Changing the background, the Theme itself on the first tab of the application, colours and fonts.

To post a comment you must log in.
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

Looks good.
Suggestion for a future evolution: Save and restore the original theme.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'gnome-appearance-properties'
2=== added file 'gnome-appearance-properties/README'
3--- gnome-appearance-properties/README 1970-01-01 00:00:00 +0000
4+++ gnome-appearance-properties/README 2010-11-19 14:48:35 +0000
5@@ -0,0 +1,21 @@
6+GNOME APPEARANCE PROPERTIES TESTS
7+=================================
8+
9+Safety
10+------
11+
12+The tests will only change the user theme but they don't touch any system file.They are safe to run.
13+
14+Configuration
15+-------------
16+
17+The tests don't need any special configuration.
18+
19+Available Tests
20+---------------
21+
22+* Change the GTK+ Theme
23+* Change the Window Border.
24+* Change the Icon Theme.
25+* Change the Pointer Theme.
26+
27
28=== added file 'gnome-appearance-properties/gnome_appearance_properties.py'
29--- gnome-appearance-properties/gnome_appearance_properties.py 1970-01-01 00:00:00 +0000
30+++ gnome-appearance-properties/gnome_appearance_properties.py 2010-11-19 14:48:35 +0000
31@@ -0,0 +1,22 @@
32+# -*- coding: utf-8 -*-
33+import os
34+from time import time, gmtime, strftime
35+
36+from mago.test_suite.gnome_appearance_properties import GnomeAppearancePropertiesTestSuite
37+
38+class GnomeAppearancePropertiesTests(GnomeAppearancePropertiesTestSuite):
39+ def change_gtk_theme(self, tab):
40+ self.application.change_appearance(tab)
41+
42+ def change_window_border(self, tab):
43+ self.application.change_appearance(tab)
44+
45+ def change_icon_theme(self, tab):
46+ self.application.change_appearance(tab)
47+
48+ def change_pointer_theme(self, tab):
49+ self.application.change_appearance(tab)
50+
51+if __name__ == "__main__":
52+ gnome_appearance_test = GnomeAppearancePropertiesTests()
53+ gnome_appearance_test.run()
54
55=== added file 'gnome-appearance-properties/gnome_appearance_properties.xml'
56--- gnome-appearance-properties/gnome_appearance_properties.xml 1970-01-01 00:00:00 +0000
57+++ gnome-appearance-properties/gnome_appearance_properties.xml 2010-11-19 14:48:35 +0000
58@@ -0,0 +1,35 @@
59+<?xml version="1.0"?>
60+<suite name="GNOME Appearance Properties">
61+ <class>gnome_appearance_properties.GnomeAppearancePropertiesTests</class>
62+ <description>
63+ Tests which verify that Gnome Appearance Properties works as it should
64+ </description>
65+ <case name="Change GTK Theme">
66+ <method>change_gtk_theme</method>
67+ <description>Test that change the GTK theme.</description>
68+ <args>
69+ <tab>CONTROLS</tab>
70+ </args>
71+ </case>
72+ <case name="Change Window Border">
73+ <method>change_window_border</method>
74+ <description>Test that change the Window Border.</description>
75+ <args>
76+ <tab>WINDOWBORDER</tab>
77+ </args>
78+ </case>
79+ <case name="Change Icon Theme">
80+ <method>change_icon_theme</method>
81+ <description>Test that change the Icon Theme.</description>
82+ <args>
83+ <tab>ICONS</tab>
84+ </args>
85+ </case>
86+ <case name="Change Pointer Theme">
87+ <method>change_pointer_theme</method>
88+ <description>Test that change the Pointer Theme.</description>
89+ <args>
90+ <tab>POINTER</tab>
91+ </args>
92+ </case>
93+</suite>
94
95=== added file 'mago/application/gnome_appearance_properties.py'
96--- mago/application/gnome_appearance_properties.py 1970-01-01 00:00:00 +0000
97+++ mago/application/gnome_appearance_properties.py 2010-11-19 14:48:35 +0000
98@@ -0,0 +1,102 @@
99+PACKAGE = "mago"
100+
101+#-*- coding:utf-8 -*-
102+"""
103+This is the "gnome_appearance_properties" module.
104+
105+This module provides a wrapper for LDTP to make writing Gnome Appearance Properties tests easier.
106+"""
107+import ooldtp
108+import ldtp
109+import os
110+from .main import Application
111+from ..gconfwrapper import GConf
112+from ..cmd import globals
113+import time
114+import gettext
115+
116+gettext.install (True)
117+gettext.bindtextdomain (PACKAGE, globals.LOCALE_SHARE)
118+gettext.textdomain (PACKAGE)
119+t = gettext.translation(PACKAGE, globals.LOCALE_SHARE, fallback = True)
120+_ = t.gettext
121+
122+
123+class GnomeAppearanceProperties(Application):
124+ """
125+ gnome_appearance_properties manages the Gnome Appearance Properties application.
126+ """
127+
128+ LAUNCHER = 'gnome-appearance-properties'
129+ LAUNCHER_ARGS = []
130+ WINDOW = 'dlgAppearancePreferences'
131+
132+ BTN_5 = _('btn5')
133+ BTN_6 = _('btn6')
134+ BTN_ADD = _('btnAdd')
135+ BTN_APPLICATIONFONT = _('btnApplicationfont')
136+ BTN_CLOSE = _('btnClose')
137+ BTN_CUSTOMIZE = _('btnCustomize')
138+ BTN_DELETE = _('btnDelete')
139+ BTN_DESKTOPFONT = _('btnDesktopfont')
140+ BTN_DETAILS = _('btnDetails')
141+ BTN_DOCUMENTFONT = _('btnDocumentfont')
142+ BTN_FIXEDWIDTHFONT = _('btnFixedwidthfont')
143+ BTN_GETMOREBACKGROUNDSONLINE = _('btnGetmorebackgroundsonline')
144+ BTN_GETMORETHEMESONLINE = _('btnGetmorethemesonline')
145+ BTN_HELP = _('btnHelp')
146+ BTN_INSTALL = _('btnInstall')
147+ BTN_PREFERENCES = _('btnPreferences')
148+ BTN_REMOVE = _('btnRemove')
149+ BTN_SAVEAS = _('btnSaveAs')
150+ BTN_WINDOWTITLEFONT = _('btnWindowtitlefont')
151+ DLG_CUSTOMIZETHEME = _('dlgCustomizeTheme')
152+ MNU_CENTER = _('mnuCenter')
153+ MNU_HORIZONTALGRADIENT = _('mnuHorizontalgradient')
154+ MNU_SCALE = _('mnuScale')
155+ MNU_SOLIDCOLOR = _('mnuSolidcolor')
156+ MNU_SPAN = _('mnuSpan')
157+ MNU_STRETCH = _('mnuStretch')
158+ MNU_TILE = _('mnuTile')
159+ MNU_VERTICALGRADIENT = _('mnuVerticalgradient')
160+ MNU_ZOOM = _('mnuZoom')
161+ TBL_CONTROLS = _('tbl0')
162+ TBL_WINDOWBORDER = _('tbl1')
163+ TBL_ICONS = _('tbl2')
164+ TBL_POINTER = _('tbl3')
165+ PTAB_CONTROLS = _('ptabControls')
166+ PTAB_WINDOWBORDER = _('ptabWindowBorder')
167+ PTAB_ICONS = _('ptabIcons')
168+ PTAB_POINTER = _('ptabPointer')
169+ PTABLE = _('ptl0')
170+
171+ APPEARANCE_TABS = {"CONTROLS" : {"TAB": PTAB_CONTROLS,
172+ "TABLE": TBL_CONTROLS},
173+ "WINDOWBORDER" : {"TAB": PTAB_WINDOWBORDER,
174+ "TABLE": TBL_WINDOWBORDER},
175+ "ICONS" : {"TAB": PTAB_ICONS,
176+ "TABLE": TBL_ICONS},
177+ "POINTER" : {"TAB": PTAB_POINTER,
178+ "TABLE": TBL_POINTER}}
179+
180+ def change_appearance(self, tab):
181+ appearance = ooldtp.context(self.name)
182+ appearance.getchild(self.BTN_CUSTOMIZE).click()
183+
184+ customizeTheme = ooldtp.context(self.DLG_CUSTOMIZETHEME)
185+ customizeTheme.getchild(self.PTABLE).selecttab(self.APPEARANCE_TABS[tab]["TAB"])
186+ self.change_elements(customizeTheme, self.APPEARANCE_TABS[tab]["TABLE"])
187+
188+ customizeTheme.getchild(self.BTN_CLOSE).click()
189+ ldtp.waittillguiexist(self.name)
190+
191+ def change_elements(self, dialog, table):
192+ row_count = dialog.getrowcount(table)
193+ row = 0
194+ while row < row_count:
195+ dialog.getcellvalue(table, row, 1)
196+ ldtp.wait(2)
197+ row+=1
198+
199+ def __init__(self):
200+ Application.__init__(self)
201
202=== added file 'mago/test_suite/gnome_appearance_properties.py'
203--- mago/test_suite/gnome_appearance_properties.py 1970-01-01 00:00:00 +0000
204+++ mago/test_suite/gnome_appearance_properties.py 2010-11-19 14:48:35 +0000
205@@ -0,0 +1,22 @@
206+"""
207+This module contains the definition of the test suite for GnomeAppearanceProperties testing.
208+"""
209+import ldtp, ooldtp
210+from .main import SingleApplicationTestSuite
211+from ..application.gnome_appearance_properties import Application, GnomeAppearanceProperties
212+
213+class GnomeAppearancePropertiesTestSuite(SingleApplicationTestSuite):
214+ """
215+ Default test suite for GnomeAppearanceProperties
216+ """
217+ APPLICATION_FACTORY = GnomeAppearanceProperties
218+ def setup(self):
219+ self.application.open()
220+
221+ def teardown(self):
222+ self.application.set_close_type('button')
223+ self.application.set_close_name('btnClose')
224+ self.application.close()
225+
226+ def cleanup(self):
227+ pass

Subscribers

People subscribed via source and target branches

to status/vote changes: