1
# -*- coding: utf-8 -*-
6
from time import time, gmtime, strftime, sleep
8
from desktoptesting.deskex import NotifyOSD
9
from desktoptesting.check import ScreenshotCompare, FAIL
11
class NotifyOSDTest(NotifyOSD):
12
def layoutTest(self, oracle=None, summary=None, body=None, icon=None):
13
self.notify(summary, body, icon)
14
elapsed, screeny = self.grab_image_and_wait(summary)
16
checker = ScreenshotCompare(oracle, screeny)
19
passed = checker.perform_test()
25
raise AssertionError('screenshots differ', screeny)
27
def queueTest(self, oracle=None, summary=None, body=None, icon=None):
28
oracles = oracle.split('|')
29
summaries = summary.split('|')
30
bodies = body.split('|')
31
icons = icon.split('|')
35
for oracle, summary, body, icons in \
36
zip(oracles, summaries, bodies, icons):
37
bubbles.append(_Bubble(oracle, summary, body, icons))
40
self.notify(b.summary, b.body, b.icon)
43
b.elapsed, b.screeny = self.grab_image_and_wait(b.summary)
46
testcheck = ScreenshotCompare(b.oracle, b.screeny)
49
check = testcheck.perform_test()
55
raise AssertionError("screenshots differ", b.screeny)
57
def synchronousTest(self, summary1=None, body1=None, icon1=None,
58
summary2=None, body2=None, icon2=None, value2=None):
61
self.notify(summary1, body1, icon1)
63
self.notify_synchronous(summary2, body2, icon2, int(value2))
65
x2, y2, w2, h2 = self.get_extents(summary2, True)
66
x1, y1, w1, h1 = self.get_extents(summary1)
69
# First bubble does not exist anymore, this could mean
70
# that the second bubble did not appear synchronously.
71
raise AssertionError("not synchronous")
72
elif (y1 + h1) - y2 > ALLOWED_OVERLAP:
73
raise AssertionError("bad overlap")
76
def __init__(self, oracle, summary, body, icon):
78
self.summary = summary