~jason-cozens/mago/unittest

« back to all changes in this revision

Viewing changes to notify-osd/notify_osd_synchronous.py

  • Committer: Eitan Isaacson
  • Date: 2009-03-22 23:36:18 UTC
  • Revision ID: eitan@ascender.com-20090322233618-npc5waa6pb08bc2d
Ported notify-osd to new framework.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- coding: utf-8 -*-
2
 
 
3
 
import ldtp
4
 
import ldtputils
5
 
 
6
 
from time import time, sleep
7
 
 
8
 
from desktoptesting.deskex import NotifyOSD
9
 
from desktoptesting.check import ScreenshotCompare, PASS, FAIL
10
 
 
11
 
ALLOWED_OVERLAP = 14
12
 
 
13
 
test = NotifyOSD()
14
 
 
15
 
dataXml  = ldtputils.LdtpDataFileParser(datafilename)
16
 
 
17
 
start_time = time()
18
 
 
19
 
test.open(False)
20
 
 
21
 
test.notify(
22
 
    dataXml.gettagvalue("summary1")[0],
23
 
    dataXml.gettagvalue("body1")[0],
24
 
    dataXml.gettagvalue("icon1")[0])
25
 
 
26
 
sleep(1)
27
 
 
28
 
test.notify_synchronous(
29
 
    dataXml.gettagvalue("summary2")[0],
30
 
    dataXml.gettagvalue("body2")[0],
31
 
    dataXml.gettagvalue("icon2")[0],
32
 
    int(dataXml.gettagvalue("value2")[0]))
33
 
 
34
 
x2, y2, w2, h2 = test.get_extents(dataXml.gettagvalue("summary2")[0], True)
35
 
x1, y1, w1, h1 = test.get_extents(dataXml.gettagvalue("summary1")[0])
36
 
 
37
 
if w1 == -1:
38
 
    # First bubble does not exist anymore, this could mean that the second
39
 
    # bubble did not appear synchronously.
40
 
    ldtp.logFailures ("Not synchronous")
41
 
    ldtp.logFailures ("Not synchronous", False, "fail") 
42
 
elif (y1 + h1) - y2 > ALLOWED_OVERLAP:
43
 
    ldtp.logFailures ("Bad overlap")
44
 
    ldtp.logFailures ("Bad overlap", False, "fail") 
45
 
    
46
 
test.exit()
47
 
 
48
 
ldtp.log (str(time() - start_time), 'time')