Merge lp:~eeejay/mago/dx into lp:~mago-contributors/mago/mago-1.0
- dx
- Merge into mago-1.0
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~eeejay/mago/dx |
Merge into: | lp:~mago-contributors/mago/mago-1.0 |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~eeejay/mago/dx |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Desktop Testing Contributors | Pending | ||
Review via email: mp+6157@code.launchpad.net |
Commit message
Description of the change
Javier Collado (javier.collado) wrote : | # |
Eitan Isaacson (eeejay) wrote : | # |
On Mon, May 4, 2009 at 5:11 PM, Javier Collado
<email address hidden> wrote:
> Hello Eitan,
>
> I took a quick look at your code and run the tests to check if everything worked in my machine. Unfortunately, I had a few of problems:
>
> - setup.py: File has to be updated to include notify-osd and indicator-applet tests.
>
Oops, I ignored the setup.py, I will update the branch with the new inclusions.
> - notify-osd: Most of the test cases failed because of screenshot differ failure. Looking at the image in the data directory and at the screenshot it seems that notify-osd draws things slightly different depending on the screen resolution, so the comparison isn't successful unless using the same screen resolution as in the original test.
>
This is a known problem. The pixmap produced depends on the
background, DPI, font and compositor used. It could be easily
collaborated by erasing the png files in the 'data' directory, and
running the suite. the suite will fail, but the next time you run it,
it will compare against new screenshots.
> - share-directory: The share directory in my installation starts with /usr/local/share and the expected shared directory starts with /usr/share so I had to change the hardcoded value to /usr/local/share to make pick it possible to run the tests. Anyway, I guess that the buildout changes once integrated will solve this issue.
That is just to pick up a random icon, it is not very important. I
chose an icon file that is likely to be in a default ubuntu-desktop
system. Anyway, yes, this should be tweaked once the buildout changes
are in trunk.
>
> Best regards,
> Javier
> --
> https:/
> You are subscribed to branch lp:~eeejay/ubuntu-desktop-testing/dx.
>
- 71. By Eitan Isaacson
-
added dx suites to setup.py
Preview Diff
1 | === added file 'desktoptesting/deskex.py' |
2 | --- desktoptesting/deskex.py 1970-01-01 00:00:00 +0000 |
3 | +++ desktoptesting/deskex.py 2009-05-04 11:21:59 +0000 |
4 | @@ -0,0 +1,200 @@ |
5 | +from desktoptesting.gnome import Application |
6 | +from time import time, sleep |
7 | +import tempfile |
8 | +import pynotify |
9 | +import ldtp, ldtputils |
10 | +import os |
11 | +import gtk, glib |
12 | + |
13 | +try: |
14 | + import indicate |
15 | +except ImportError: |
16 | + indicate = None |
17 | + |
18 | +class IndicatorApplet(Application): |
19 | + IA_TOPLEVEL = "embindicator-applet" |
20 | + def __init__(self): |
21 | + Application.__init__(self, 'indicator-applet') |
22 | + self.indicators = [] |
23 | + self.server = None |
24 | + |
25 | + def open(self): |
26 | + pass |
27 | + |
28 | + def add_server(self, desktop_file): |
29 | + if not self.server: |
30 | + try: |
31 | + self.server = indicate.indicate_server_ref_default() |
32 | + except AttributeError: |
33 | + raise Exception, \ |
34 | + "no libindicate Python bindings, install python-indicate." |
35 | + self.server.set_type("message.im") |
36 | + self.server.set_desktop_file(desktop_file) |
37 | + self.server.show() |
38 | + while gtk.events_pending(): |
39 | + gtk.main_iteration() |
40 | + |
41 | + def show_indicator(self, sender): |
42 | + def _timeout_cb(): |
43 | + gtk.main_quit() |
44 | + return False |
45 | + |
46 | + indicator = indicate.IndicatorMessage() |
47 | + indicator.set_property("subtype", "im") |
48 | + indicator.set_property("sender", sender) |
49 | + indicator.set_property_time("time", time()) |
50 | + pixbuf = gtk.gdk.pixbuf_new_from_file( |
51 | + "/usr/share/icons/hicolor/22x22/apps/gnome-freecell.png") |
52 | + indicator.set_property_icon("icon", pixbuf) |
53 | + indicator.show() |
54 | + self.indicators.append(indicator) |
55 | + glib.timeout_add_seconds(1, _timeout_cb) |
56 | + gtk.main() |
57 | + |
58 | + def capture_applet_icon(self): |
59 | + x, y, w, h = ldtp.getobjectsize(self.TOP_PANEL, self.IA_TOPLEVEL) |
60 | + screeny = ldtputils.imagecapture( |
61 | + outFile=tempfile.mktemp('.png', 'ia_'), |
62 | + x=x, y=y, resolution1=w, resolution2=h) |
63 | + return screeny |
64 | + |
65 | + def select_indicator(self, sender): |
66 | + ldtp.selectmenuitem(self.TOP_PANEL, 'mnu' + sender.replace(' ','')) |
67 | + |
68 | + def wait_for_indicator_display(self, sender, timeout=5): |
69 | + handlers = [] |
70 | + displayed = [False] |
71 | + |
72 | + def _display_cb(indicator): |
73 | + indicator.hide() # This is just normal behavior, so why not? |
74 | + displayed[0] = True |
75 | + gtk.main_quit() |
76 | + |
77 | + def _timeout_cb(): |
78 | + gtk.main_quit() |
79 | + return False |
80 | + |
81 | + for indicator in self.indicators: |
82 | + if sender == indicator.get_property("sender"): |
83 | + handler = indicator.connect("user-display", _display_cb) |
84 | + handlers.append((handler, indicator)) |
85 | + |
86 | + glib.timeout_add_seconds(timeout, _timeout_cb) |
87 | + |
88 | + gtk.main() |
89 | + |
90 | + for handler, indicator in handlers: |
91 | + indicator.disconnect(handler) |
92 | + |
93 | + return displayed[0] |
94 | + |
95 | + def wait_for_server_display(self, timeout=5): |
96 | + displayed = [False] |
97 | + handler = 0 |
98 | + |
99 | + def _display_cb(indicator): |
100 | + indicator.hide() # This is just normal behavior, so why not? |
101 | + displayed[0] = True |
102 | + gtk.main_quit() |
103 | + |
104 | + def _timeout_cb(): |
105 | + gtk.main_quit() |
106 | + return False |
107 | + |
108 | + handler = self.server.connect("server-display", _display_cb) |
109 | + |
110 | + glib.timeout_add_seconds(timeout, _timeout_cb) |
111 | + |
112 | + gtk.main() |
113 | + |
114 | + self.server.disconnect(handler) |
115 | + |
116 | + return displayed[0] |
117 | + |
118 | + def cleanup(self): |
119 | + for indicator in self.indicators: |
120 | + indicator.hide() |
121 | + # BUG: 351537 |
122 | + # self.server.hide() |
123 | + sleep(1) |
124 | + |
125 | + def close(self): |
126 | + self.cleanup() |
127 | + |
128 | + def setup(self): |
129 | + self.open() |
130 | + |
131 | + def teardown(self): |
132 | + self.close() |
133 | + |
134 | +class NotifyOSD(Application): |
135 | + def __init__(self): |
136 | + self.focus_desktop = False |
137 | + self.screenshots = [] |
138 | + |
139 | + if not pynotify.init('notify-osd-test'): |
140 | + raise ldtp.LdtpExecutionError, \ |
141 | + "Failed to initialize notification connection." |
142 | + |
143 | + info = pynotify.get_server_info() |
144 | + if info.get('name', None) != 'notify-osd': |
145 | + raise ldtp.LdtpExecutionError, \ |
146 | + "The notify service is '%s', expected 'notify-dameon'" % \ |
147 | + info.get('name', None) |
148 | + |
149 | + def open(self, focus_desktop=True): |
150 | + self.focus_desktop = focus_desktop |
151 | + |
152 | + if self.focus_desktop: |
153 | + ldtp.generatekeyevent('<alt><ctrl>d') |
154 | + |
155 | + def exit(self): |
156 | + if self.focus_desktop: |
157 | + ldtp.generatekeyevent('<alt><ctrl>d') |
158 | + for screenshot in self.screenshots: |
159 | + os.remove(screenshot) |
160 | + |
161 | + def notify(self, summary, body="", icon=None): |
162 | + n = pynotify.Notification (summary, body, icon) |
163 | + n.show () |
164 | + |
165 | + def notify_synchronous(self, summary, body="", icon=None, value=-1): |
166 | + n = pynotify.Notification (summary, body, icon) |
167 | + n.set_hint("synchronous", "volume") |
168 | + n.set_hint("value", value) |
169 | + n.show () |
170 | + |
171 | + def grab_image_and_wait(self, summary): |
172 | + ldtp.waittillguiexist(summary) |
173 | + start_time = time() |
174 | + x, y, w, h = ldtp.getwindowsize(summary) |
175 | + screenshot = \ |
176 | + ldtputils.imagecapture(outFile=tempfile.mktemp('.png', 'nosd_'), |
177 | + x=x+3, y=y+3, |
178 | + resolution1=w-6, |
179 | + resolution2=h-6) |
180 | + ldtp.waittillguinotexist(summary) |
181 | + end_time = time() - start_time |
182 | + self.screenshots.append(screenshot) |
183 | + return (end_time, screenshot) |
184 | + |
185 | + def get_extents(self, summary, wait=False): |
186 | + if wait: |
187 | + exists = ldtp.waittillguiexist(summary) |
188 | + else: |
189 | + exists = ldtp.guiexist(summary) |
190 | + |
191 | + if exists: |
192 | + return ldtp.getwindowsize(summary) |
193 | + else: |
194 | + return -1, -1, -1, -1 |
195 | + |
196 | +if __name__ == "__main__": |
197 | + from time import sleep |
198 | + test = IndicatorApplet() |
199 | + test.open() |
200 | + test.add_server('/usr/share/applications/transmission.desktop') |
201 | + test.show_indicator('Elmer Fud') |
202 | + print 'sleeping' |
203 | + sleep(20) |
204 | + #print test.wait_for_indicator_display('Elmer Fud', 20) |
205 | |
206 | === added directory 'indicator-applet' |
207 | === added directory 'indicator-applet/data' |
208 | === added file 'indicator-applet/data/indicator_test.desktop' |
209 | --- indicator-applet/data/indicator_test.desktop 1970-01-01 00:00:00 +0000 |
210 | +++ indicator-applet/data/indicator_test.desktop 2009-03-26 14:55:36 +0000 |
211 | @@ -0,0 +1,10 @@ |
212 | +[Desktop Entry] |
213 | +Encoding=UTF-8 |
214 | +Name=Phony Internet Messenger |
215 | +GenericName=Internet Messenger |
216 | +Comment=Send instant messages over phony protocols |
217 | +Exec=phony |
218 | +StartupNotify=true |
219 | +Terminal=false |
220 | +Type=Application |
221 | +Categories=Network;InstantMessaging; |
222 | |
223 | === added file 'indicator-applet/indicator_applet.py' |
224 | --- indicator-applet/indicator_applet.py 1970-01-01 00:00:00 +0000 |
225 | +++ indicator-applet/indicator_applet.py 2009-04-01 09:14:02 +0000 |
226 | @@ -0,0 +1,49 @@ |
227 | +# -*- coding: utf-8 -*- |
228 | + |
229 | +import ldtp |
230 | +import ldtputils |
231 | +import os |
232 | + |
233 | +from time import time, gmtime, strftime, sleep |
234 | +from desktoptesting.check import ScreenshotCompare, FAIL |
235 | +from desktoptesting.deskex import IndicatorApplet |
236 | + |
237 | +class IndicatorAppletTest(IndicatorApplet): |
238 | + def serverTest(self, desktop_file=None): |
239 | + self.add_server(os.path.abspath(desktop_file)) |
240 | + if not ldtp.objectexist(self.TOP_PANEL, 'mnuPhonyInternetMessenger'): |
241 | + raise AssertionError("server does not appear in applet.") |
242 | + |
243 | + def messageTest(self, desktop_file=None, sender=None): |
244 | + self.add_server(os.path.abspath(desktop_file)) |
245 | + self.show_indicator(sender) |
246 | + sleep(1) |
247 | + if not ldtp.objectexist(self.TOP_PANEL, 'mnu' + sender.replace(' ','')): |
248 | + raise AssertionError('indicator did not appear in applet.') |
249 | + |
250 | + def iconChangeTest(self, desktop_file=None, sender=None): |
251 | + self.add_server(os.path.abspath(desktop_file)) |
252 | + no_message = self.capture_applet_icon() |
253 | + self.show_indicator(sender) |
254 | + with_message = self.capture_applet_icon() |
255 | + |
256 | + checker = ScreenshotCompare(no_message, with_message) |
257 | + |
258 | + if checker.perform_test() != FAIL: |
259 | + raise AssertionError('icon did not change.') |
260 | + |
261 | + def displayIndicatorTest(self, desktop_file=None, sender=None): |
262 | + self.add_server(os.path.abspath(desktop_file)) |
263 | + self.show_indicator(sender) |
264 | + sleep(1) |
265 | + self.select_indicator(sender) |
266 | + if not self.wait_for_indicator_display(sender): |
267 | + raise AssertionError('Indicator did not get a callback') |
268 | + |
269 | + def displayServerTest(self, desktop_file=None): |
270 | + self.add_server(os.path.abspath(desktop_file)) |
271 | + sleep(1) |
272 | + ldtp.selectmenuitem(self.TOP_PANEL, 'mnuPhonyInternetMessenger') |
273 | + if not self.wait_for_server_display(): |
274 | + raise AssertionError('Server did not get a callback') |
275 | + |
276 | |
277 | === added file 'indicator-applet/indicator_applet.xml' |
278 | --- indicator-applet/indicator_applet.xml 1970-01-01 00:00:00 +0000 |
279 | +++ indicator-applet/indicator_applet.xml 2009-03-31 10:46:34 +0000 |
280 | @@ -0,0 +1,70 @@ |
281 | +<?xml version="1.0"?> |
282 | +<suite name="indicator-applet"> |
283 | + <class>indicator_applet.IndicatorAppletTest</class> |
284 | + <description>indicator-applet tests</description> |
285 | + <case name="Server"> |
286 | + <method>serverTest</method> |
287 | + <description> |
288 | + Add a server to the indicator applet. |
289 | + </description> |
290 | + <args> |
291 | + <desktop_file> |
292 | + ./indicator-applet/data/indicator_test.desktop |
293 | + </desktop_file> |
294 | + </args> |
295 | + </case> |
296 | + <case name="MessageIndicator"> |
297 | + <method>messageTest</method> |
298 | + <description> |
299 | + Add a message indicator to the indicator applet. |
300 | + </description> |
301 | + <args> |
302 | + <desktop_file> |
303 | + ./indicator-applet/data/indicator_test.desktop |
304 | + </desktop_file> |
305 | + <sender> |
306 | + Elmer Fud |
307 | + </sender> |
308 | + </args> |
309 | + </case> |
310 | + <case name="IconChange"> |
311 | + <method>iconChangeTest</method> |
312 | + <description> |
313 | + Test to see if the applet's icon changes when a new message arrives. |
314 | + </description> |
315 | + <args> |
316 | + <desktop_file> |
317 | + ./indicator-applet/data/indicator_test.desktop |
318 | + </desktop_file> |
319 | + <sender> |
320 | + Elmer Fud |
321 | + </sender> |
322 | + </args> |
323 | + </case> |
324 | + <case name="DisplayIndicator"> |
325 | + <method>displayIndicatorTest</method> |
326 | + <description> |
327 | + Test to see if the display callback is called when message |
328 | + indicator is selected. |
329 | + </description> |
330 | + <args> |
331 | + <desktop_file> |
332 | + ./indicator-applet/data/indicator_test.desktop |
333 | + </desktop_file> |
334 | + <sender> |
335 | + Elmer Fud |
336 | + </sender> |
337 | + </args> |
338 | + </case> |
339 | + <case name="DisplayServer"> |
340 | + <method>displayServerTest</method> |
341 | + <description> |
342 | + Test to see if the display callback is called when a server is selected. |
343 | + </description> |
344 | + <args> |
345 | + <desktop_file> |
346 | + ./indicator-applet/data/indicator_test.desktop |
347 | + </desktop_file> |
348 | + </args> |
349 | + </case> |
350 | +</suite> |
351 | |
352 | === added directory 'notify-osd' |
353 | === added directory 'notify-osd/data' |
354 | === added file 'notify-osd/data/bubble_queue.xml' |
355 | --- notify-osd/data/bubble_queue.xml 1970-01-01 00:00:00 +0000 |
356 | +++ notify-osd/data/bubble_queue.xml 2009-03-04 11:00:22 +0000 |
357 | @@ -0,0 +1,7 @@ |
358 | +<?xml version="1.0"?> |
359 | +<data> |
360 | + <bubble>icons_summary_body_data.xml</bubble> |
361 | + <bubble>icons_summary_data.xml</bubble> |
362 | + <bubble>summary_body_data.xml</bubble> |
363 | + <bubble>summary_data.xml</bubble> |
364 | +</data> |
365 | |
366 | === added file 'notify-osd/data/icons_summary.png' |
367 | Binary files notify-osd/data/icons_summary.png 1970-01-01 00:00:00 +0000 and notify-osd/data/icons_summary.png 2009-05-04 09:33:24 +0000 differ |
368 | === added file 'notify-osd/data/icons_summary_body.png' |
369 | Binary files notify-osd/data/icons_summary_body.png 1970-01-01 00:00:00 +0000 and notify-osd/data/icons_summary_body.png 2009-05-04 09:33:24 +0000 differ |
370 | === added file 'notify-osd/data/icons_summary_body_data.xml' |
371 | --- notify-osd/data/icons_summary_body_data.xml 1970-01-01 00:00:00 +0000 |
372 | +++ notify-osd/data/icons_summary_body_data.xml 2009-02-28 14:03:43 +0000 |
373 | @@ -0,0 +1,7 @@ |
374 | +<?xml version="1.0"?> |
375 | +<data> |
376 | + <oracle>./notify-osd/data/icons_summary_body.png</oracle> |
377 | + <summary>Nat King Cole</summary> |
378 | + <body>Hey pal, what's up with the party next weekend? Will you join me and Anna?</body> |
379 | + <icon>notification-message-IM</icon> |
380 | +</data> |
381 | |
382 | === added file 'notify-osd/data/icons_summary_data.xml' |
383 | --- notify-osd/data/icons_summary_data.xml 1970-01-01 00:00:00 +0000 |
384 | +++ notify-osd/data/icons_summary_data.xml 2009-02-28 14:03:43 +0000 |
385 | @@ -0,0 +1,7 @@ |
386 | +<?xml version="1.0"?> |
387 | +<data> |
388 | + <oracle>./notify-osd/data/icons_summary.png</oracle> |
389 | + <summary>WiFi connection lost</summary> |
390 | + <body></body> |
391 | + <icon>notification-network-wireless-disconnected</icon> |
392 | +</data> |
393 | |
394 | === added file 'notify-osd/data/summary.png' |
395 | Binary files notify-osd/data/summary.png 1970-01-01 00:00:00 +0000 and notify-osd/data/summary.png 2009-05-04 09:33:24 +0000 differ |
396 | === added file 'notify-osd/data/summary_body.png' |
397 | Binary files notify-osd/data/summary_body.png 1970-01-01 00:00:00 +0000 and notify-osd/data/summary_body.png 2009-05-04 09:33:24 +0000 differ |
398 | === added file 'notify-osd/data/summary_body_data.xml' |
399 | --- notify-osd/data/summary_body_data.xml 1970-01-01 00:00:00 +0000 |
400 | +++ notify-osd/data/summary_body_data.xml 2009-02-28 14:03:43 +0000 |
401 | @@ -0,0 +1,7 @@ |
402 | +<?xml version="1.0"?> |
403 | +<data> |
404 | + <oracle>./notify-osd/data/summary_body.png</oracle> |
405 | + <summary>Totem</summary> |
406 | + <body>This is a superfluous notification</body> |
407 | + <icon></icon> |
408 | +</data> |
409 | |
410 | === added file 'notify-osd/data/summary_data.xml' |
411 | --- notify-osd/data/summary_data.xml 1970-01-01 00:00:00 +0000 |
412 | +++ notify-osd/data/summary_data.xml 2009-02-28 14:03:43 +0000 |
413 | @@ -0,0 +1,7 @@ |
414 | +<?xml version="1.0"?> |
415 | +<data> |
416 | + <oracle>./notify-osd/data/summary.png</oracle> |
417 | + <summary>Summary-only</summary> |
418 | + <body></body> |
419 | + <icon></icon> |
420 | +</data> |
421 | |
422 | === added file 'notify-osd/data/synchronous_data.xml' |
423 | --- notify-osd/data/synchronous_data.xml 1970-01-01 00:00:00 +0000 |
424 | +++ notify-osd/data/synchronous_data.xml 2009-03-04 13:24:54 +0000 |
425 | @@ -0,0 +1,11 @@ |
426 | +<?xml version="1.0"?> |
427 | +<data> |
428 | + <summary1>Nat King Cole</summary1> |
429 | + <body1>Hey pal, what's up with the party next weekend? Will you join me and Anna?</body1> |
430 | + <icon1>notification-message-IM</icon1> |
431 | + |
432 | + <summary2>Volume</summary2> |
433 | + <body2></body2> |
434 | + <icon2>notification-audio-volume-medium</icon2> |
435 | + <value2>75</value2> |
436 | +</data> |
437 | |
438 | === added file 'notify-osd/notify_osd.py' |
439 | --- notify-osd/notify_osd.py 1970-01-01 00:00:00 +0000 |
440 | +++ notify-osd/notify_osd.py 2009-03-22 23:36:18 +0000 |
441 | @@ -0,0 +1,82 @@ |
442 | +# -*- coding: utf-8 -*- |
443 | + |
444 | +import ldtp |
445 | +import ldtputils |
446 | + |
447 | +from time import time, gmtime, strftime, sleep |
448 | + |
449 | +from desktoptesting.deskex import NotifyOSD |
450 | +from desktoptesting.check import ScreenshotCompare, FAIL |
451 | + |
452 | +class NotifyOSDTest(NotifyOSD): |
453 | + def layoutTest(self, oracle=None, summary=None, body=None, icon=None): |
454 | + self.notify(summary, body, icon) |
455 | + elapsed, screeny = self.grab_image_and_wait(summary) |
456 | + |
457 | + checker = ScreenshotCompare(oracle, screeny) |
458 | + |
459 | + try: |
460 | + passed = checker.perform_test() |
461 | + except Exception, e: |
462 | + checker.calibrate() |
463 | + raise e |
464 | + |
465 | + if passed == FAIL: |
466 | + raise AssertionError('screenshots differ', screeny) |
467 | + |
468 | + def queueTest(self, oracle=None, summary=None, body=None, icon=None): |
469 | + oracles = oracle.split('|') |
470 | + summaries = summary.split('|') |
471 | + bodies = body.split('|') |
472 | + icons = icon.split('|') |
473 | + |
474 | + bubbles = [] |
475 | + |
476 | + for oracle, summary, body, icons in \ |
477 | + zip(oracles, summaries, bodies, icons): |
478 | + bubbles.append(_Bubble(oracle, summary, body, icons)) |
479 | + |
480 | + for b in bubbles: |
481 | + self.notify(b.summary, b.body, b.icon) |
482 | + |
483 | + for b in bubbles: |
484 | + b.elapsed, b.screeny = self.grab_image_and_wait(b.summary) |
485 | + |
486 | + for b in bubbles: |
487 | + testcheck = ScreenshotCompare(b.oracle, b.screeny) |
488 | + |
489 | + try: |
490 | + check = testcheck.perform_test() |
491 | + except Exception, e: |
492 | + testcheck.calibrate() |
493 | + raise e |
494 | + |
495 | + if check == FAIL: |
496 | + raise AssertionError("screenshots differ", b.screeny) |
497 | + |
498 | + def synchronousTest(self, summary1=None, body1=None, icon1=None, |
499 | + summary2=None, body2=None, icon2=None, value2=None): |
500 | + ALLOWED_OVERLAP = 14 |
501 | + |
502 | + self.notify(summary1, body1, icon1) |
503 | + sleep(1) |
504 | + self.notify_synchronous(summary2, body2, icon2, int(value2)) |
505 | + |
506 | + x2, y2, w2, h2 = self.get_extents(summary2, True) |
507 | + x1, y1, w1, h1 = self.get_extents(summary1) |
508 | + |
509 | + if w1 == -1: |
510 | + # First bubble does not exist anymore, this could mean |
511 | + # that the second bubble did not appear synchronously. |
512 | + raise AssertionError("not synchronous") |
513 | + elif (y1 + h1) - y2 > ALLOWED_OVERLAP: |
514 | + raise AssertionError("bad overlap") |
515 | + |
516 | +class _Bubble: |
517 | + def __init__(self, oracle, summary, body, icon): |
518 | + self.oracle = oracle |
519 | + self.summary = summary |
520 | + self.body = body |
521 | + self.icon = icon |
522 | + self.elapsed = None |
523 | + self.screeny = None |
524 | |
525 | === added file 'notify-osd/notify_osd.xml' |
526 | --- notify-osd/notify_osd.xml 1970-01-01 00:00:00 +0000 |
527 | +++ notify-osd/notify_osd.xml 2009-03-22 23:36:18 +0000 |
528 | @@ -0,0 +1,80 @@ |
529 | +<?xml version="1.0"?> |
530 | +<suite name="notify-osd"> |
531 | + <class>notify_osd.NotifyOSDTest</class> |
532 | + <description>notify-osd tests</description> |
533 | + <case name="IconSummaryBody"> |
534 | + <method>layoutTest</method> |
535 | + <description> |
536 | + Test the layout of a bubble with an icon, summary and body |
537 | + </description> |
538 | + <args> |
539 | + <oracle>./notify-osd/data/icons_summary_body.png</oracle> |
540 | + <summary>Nat King Cole</summary> |
541 | + <body>Hey pal, what's up with the party next weekend? Will you join me and Anna?</body> |
542 | + <icon>notification-message-IM</icon> |
543 | + </args> |
544 | + </case> |
545 | + <case name="IconSummary"> |
546 | + <method>layoutTest</method> |
547 | + <description> |
548 | + Test the layout of a bubble with an icon and summary. |
549 | + </description> |
550 | + <args> |
551 | + <oracle>./notify-osd/data/icons_summary.png</oracle> |
552 | + <summary>WiFi connection lost</summary> |
553 | + <body></body> |
554 | + <icon>notification-network-wireless-disconnected</icon> |
555 | + </args> |
556 | + </case> |
557 | + <case name="SummaryBody"> |
558 | + <method>layoutTest</method> |
559 | + <description> |
560 | + Test the layout of a bubble with a summary only. |
561 | + </description> |
562 | + <args> |
563 | + <oracle>./notify-osd/data/summary_body.png</oracle> |
564 | + <summary>Totem</summary> |
565 | + <body>This is a superfluous notification</body> |
566 | + <icon></icon> |
567 | + </args> |
568 | + </case> |
569 | + <case name="Summary"> |
570 | + <method>layoutTest</method> |
571 | + <description> |
572 | + Test the layout of a bubble with a summary only. |
573 | + </description> |
574 | + <args> |
575 | + <oracle>./notify-osd/data/summary.png</oracle> |
576 | + <summary>Summary-only</summary> |
577 | + <body></body> |
578 | + <icon></icon> |
579 | + </args> |
580 | + </case> |
581 | + <case name="Queue"> |
582 | + <method>queueTest</method> |
583 | + <description> |
584 | + Test the bubble queue. |
585 | + </description> |
586 | + <args> |
587 | + <oracle>./notify-osd/data/icons_summary_body.png|./notify-osd/data/icons_summary.png|./notify-osd/data/summary.png</oracle> |
588 | + <summary>Nat King Cole|WiFi connection lost|Summary-only</summary> |
589 | + <body>Hey pal, what's up with the party next weekend? Will you join me and Anna?||</body> |
590 | + <icon>notification-message-IM|notification-network-wireless-disconnected|</icon> |
591 | + </args> |
592 | + </case> |
593 | + <case name="Synchronous"> |
594 | + <method>synchronousTest</method> |
595 | + <description> |
596 | + Test synchronous bubbles. |
597 | + </description> |
598 | + <args> |
599 | + <summary1>Nat King Cole</summary1> |
600 | + <body1>Hey pal, what's up with the party next weekend? Will you join me and Anna?</body1> |
601 | + <icon1>notification-message-IM</icon1> |
602 | + <summary2>Volume</summary2> |
603 | + <body2></body2> |
604 | + <icon2>notification-audio-volume-medium</icon2> |
605 | + <value2>75</value2> |
606 | + </args> |
607 | + </case> |
608 | +</suite> |
Hello Eitan,
I took a quick look at your code and run the tests to check if everything worked in my machine. Unfortunately, I had a few of problems:
- setup.py: File has to be updated to include notify-osd and indicator-applet tests.
- notify-osd: Most of the test cases failed because of screenshot differ failure. Looking at the image in the data directory and at the screenshot it seems that notify-osd draws things slightly different depending on the screen resolution, so the comparison isn't successful unless using the same screen resolution as in the original test.
- share-directory: The share directory in my installation starts with /usr/local/share and the expected shared directory starts with /usr/share so I had to change the hardcoded value to /usr/local/share to make it possible to run the tests. Anyway, I guess that the buildout changes once integrated will solve this issue.
Best regards,
Javier