~dhillon-v10/qa-regression-testing/mago-packages-checking

« back to all changes in this revision

Viewing changes to indicator-applet/indicator_applet.py

  • Committer: Vikram Dhillon
  • Date: 2010-01-12 02:42:18 UTC
  • Revision ID: dhillonv10@gmail.com-20100112024218-7ntl2wrpbxqjb3kx
Initial commit: getting in the data from mago

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
 
 
3
import ldtp
 
4
import ldtputils
 
5
import os
 
6
 
 
7
from time import time, gmtime, strftime, sleep
 
8
from mago.check import ScreenshotCompare, FAIL
 
9
from mago.test_suite.deskex import IndicatorAppletTestSuite
 
10
 
 
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.")
 
16
 
 
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)
 
20
        sleep(1)
 
21
        if not self.application.is_indicator_shown(sender):
 
22
            raise AssertionError('indicator did not appear in applet.')
 
23
 
 
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()
 
29
 
 
30
        checker = ScreenshotCompare(no_message, with_message)
 
31
        
 
32
        if checker.perform_test() != FAIL:
 
33
            raise AssertionError('icon did not change.')
 
34
 
 
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)
 
38
        sleep(1)
 
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')
 
42
 
 
43
    def displayServerTest(self, desktop_file=None):
 
44
        self.application.add_server(os.path.abspath(desktop_file))
 
45
        sleep(1)
 
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')
 
49