1
# -*- coding: utf-8 -*-
7
from time import time, gmtime, strftime, sleep
8
from mago.check import ScreenshotCompare, FAIL
9
from mago.test_suite.deskex import IndicatorAppletTestSuite
11
class IndicatorAppletTest(IndicatorAppletTestSuite):
12
def serverTest(self, desktop_file=None):
13
self.application.add_server(os.path.abspath(desktop_file))
14
if not self.application.is_server_shown('Phony Internet Messenger', False):
15
raise AssertionError("server does not appear in applet.")
17
def messageTest(self, desktop_file=None, sender=None):
18
self.application.add_server(os.path.abspath(desktop_file))
19
self.application.show_indicator(sender)
21
if not self.application.is_indicator_shown(sender):
22
raise AssertionError('indicator did not appear in applet.')
24
def iconChangeTest(self, desktop_file=None, sender=None):
25
self.application.add_server(os.path.abspath(desktop_file))
26
no_message = self.application.capture_applet_icon()
27
self.application.show_indicator(sender)
28
with_message = self.application.capture_applet_icon()
30
checker = ScreenshotCompare(no_message, with_message)
32
if checker.perform_test() != FAIL:
33
raise AssertionError('icon did not change.')
35
def displayIndicatorTest(self, desktop_file=None, sender=None):
36
self.application.add_server(os.path.abspath(desktop_file))
37
self.application.show_indicator(sender)
39
self.application.select_indicator(sender)
40
if not self.application.wait_for_indicator_display(sender):
41
raise AssertionError('Indicator did not get a callback')
43
def displayServerTest(self, desktop_file=None):
44
self.application.add_server(os.path.abspath(desktop_file))
46
self.application.select_server('Phony Internet Messenger', False)
47
if not self.application.wait_for_server_display():
48
raise AssertionError('Server did not get a callback')