Merge lp:~marjo-mercado/mago/xchat_test into lp:~mago-contributors/mago/mago-1.0

Proposed by Marjo F. Mercado
Status: Merged
Merged at revision: 158
Proposed branch: lp:~marjo-mercado/mago/xchat_test
Merge into: lp:~mago-contributors/mago/mago-1.0
Diff against target: 172 lines (+147/-0)
5 files modified
mago/application/xchat.py (+83/-0)
mago/test_suite/xchat.py (+20/-0)
xchat/README (+17/-0)
xchat/xchat_basics.py (+13/-0)
xchat/xchat_basics.xml (+14/-0)
To merge this branch: bzr merge lp:~marjo-mercado/mago/xchat_test
Reviewer Review Type Date Requested Status
Nagappan Alagappan Approve
Review via email: mp+43801@code.launchpad.net

Description of the change

Initial version of xchat tests.

To post a comment you must log in.
Revision history for this message
Nagappan Alagappan (nagappan) wrote :

Looks fine to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'mago/application/xchat.py'
2--- mago/application/xchat.py 1970-01-01 00:00:00 +0000
3+++ mago/application/xchat.py 2010-12-15 17:38:54 +0000
4@@ -0,0 +1,83 @@
5+PACKAGE = "mago"
6+
7+#-*- coding:utf-8 -*-
8+"""
9+This is the "xchat" module.
10+
11+This module provides a wrapper for LDTP to make writing Xchat tests easier.
12+"""
13+import ooldtp
14+import ldtp
15+import os
16+from .main import Application
17+from ..gconfwrapper import GConf
18+from ..cmd import globals
19+import time
20+import gettext
21+
22+gettext.install (True)
23+gettext.bindtextdomain (PACKAGE, globals.LOCALE_SHARE)
24+gettext.textdomain (PACKAGE)
25+t = gettext.translation(PACKAGE, globals.LOCALE_SHARE, fallback = True)
26+_ = t.gettext
27+
28+
29+class Xchat(Application):
30+ """
31+ xchat manages the Xchat application.
32+ """
33+
34+ LAUNCHER = 'xchat'
35+ LAUNCHER_ARGS = []
36+ WINDOW = 'frmXChat'
37+
38+ MNU_ABOUT = _('mnuAbout')
39+ MNU_CLOSE = _('mnuClose')
40+ MNU_NEW = _('mnuNew')
41+
42+
43+ def runAboutdialog(self):
44+ """
45+ This basic test simply verifies that the application launches
46+ and that the UI reacts
47+ The About dialog is the only menu that is always present in the UI
48+ """
49+ if self.MNU_ABOUT:
50+ self.main_window.click(self.MNU_ABOUT)
51+
52+ # Wait for the dialog to open
53+ # Name of about dialogs change with the app
54+ timeout=60
55+ dlgAbout=None
56+ while not ( timeout>0 and dlgAbout):
57+ dlgs=[ w for w in ldtp.getwindowlist() if w.startswith('dlgAbout')]
58+ if dlgs:
59+ dlgAbout = dlgs[0]
60+ timeout -= 1
61+ time.sleep(1)
62+
63+ if not dlgAbout:
64+ raise AssertionError('About Dialog not found')
65+
66+
67+ # Looking for a button to close the window
68+ found = None
69+ for btnClose in ('btnClose', 'btnOK', 'btnCancel'):
70+ try:
71+ found = ldtp.getchild(dlgAbout, btnClose, 'push button')
72+ break
73+ except:
74+ pass
75+
76+ if not found:
77+ return
78+
79+ ldtp.click(dlgAbout, btnClose)
80+
81+
82+ def close(self):
83+ self.main_window.click('mnuQuit')
84+
85+ def __init__(self):
86+ Application.__init__(self)
87+ self.main_window = ooldtp.context(self.WINDOW)
88
89=== added file 'mago/test_suite/xchat.py'
90--- mago/test_suite/xchat.py 1970-01-01 00:00:00 +0000
91+++ mago/test_suite/xchat.py 2010-12-15 17:38:54 +0000
92@@ -0,0 +1,20 @@
93+"""
94+This module contains the definition of the test suite for Xchat testing.
95+"""
96+import ldtp, ooldtp
97+from .main import SingleApplicationTestSuite
98+from ..application.xchat import Application, Xchat
99+
100+class XchatTestSuite(SingleApplicationTestSuite):
101+ """
102+ Default test suite for Xchat
103+ """
104+ APPLICATION_FACTORY = Xchat
105+ def setup(self):
106+ self.application.open()
107+
108+ def teardown(self):
109+ self.application.close()
110+
111+ def cleanup(self):
112+ self.application.close()
113
114=== added directory 'xchat'
115=== added file 'xchat/README'
116--- xchat/README 1970-01-01 00:00:00 +0000
117+++ xchat/README 2010-12-15 17:38:54 +0000
118@@ -0,0 +1,17 @@
119+xchat Tests
120+---------------------
121+Tests that verify xchat functionality.
122+
123+Safety
124+------
125+None of these tests touches any configuration or system files.
126+
127+Configuration
128+-------------
129+Nothing
130+
131+Available Tests
132+---------------
133+
134+* about_dialog: runs the about dialog
135+
136
137=== added file 'xchat/xchat_basics.py'
138--- xchat/xchat_basics.py 1970-01-01 00:00:00 +0000
139+++ xchat/xchat_basics.py 2010-12-15 17:38:54 +0000
140@@ -0,0 +1,13 @@
141+# -*- coding: utf-8 -*-
142+import os
143+from time import time, gmtime, strftime
144+
145+from mago.test_suite.xchat import XchatTestSuite
146+
147+class XchatBasics(XchatTestSuite):
148+ def testAboutdialog(self, arg1=None):
149+ self.application.runAboutdialog()
150+
151+if __name__ == "__main__":
152+ xchat_test = XchatBasics()
153+ xchat_test.run()
154
155=== added file 'xchat/xchat_basics.xml'
156--- xchat/xchat_basics.xml 1970-01-01 00:00:00 +0000
157+++ xchat/xchat_basics.xml 2010-12-15 17:38:54 +0000
158@@ -0,0 +1,14 @@
159+<?xml version="1.0"?>
160+<suite name="Xchat">
161+ <class>xchat_basics.XchatBasics</class>
162+ <description>
163+ Tests which verify Xchat basics functionality.
164+ </description>
165+ <case name="about_dialog">
166+ <method>testAboutdialog</method>
167+ <description>Verify that the about dialog launches</description>
168+ <args>
169+ <arg1>Arg example</arg1>
170+ </args>
171+ </case>
172+</suite>

Subscribers

People subscribed via source and target branches

to status/vote changes: