~helene-verhaeghe27/cairo-dock-core/bugfix

« back to all changes in this revision

Viewing changes to tests/TestDockManager.py

  • Committer: Fabrice Rey
  • Date: 2013-06-28 23:44:28 UTC
  • Revision ID: fabounet03@gmail.com-20130628234428-cwsvh6mexcfm0063
Added a test framework, and several tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from time import sleep
 
2
from Test import Test, key, set_param
 
3
from CairoDock import CairoDock
 
4
 
 
5
# test taskbar with ungrouped windows
 
6
class TestDockManager(Test):
 
7
        def __init__(self, dock):
 
8
                self.mgr = 'Docks'
 
9
                self.dt = .2  # time to update the dock size
 
10
                Test.__init__(self, "Test Docks", dock)
 
11
        
 
12
        def run(self):
 
13
                
 
14
                props = self.d.GetProperties('type=Dock')
 
15
                height_ini = props[0]['height']
 
16
                y_ini = props[0]['y']
 
17
                
 
18
                # change the line width
 
19
                set_param (self.get_conf_file(), "Background", "line width", "1")  # from 2 to 1
 
20
                self.d.Reload('type=Manager & name='+self.mgr)
 
21
                sleep(self.dt)  # let the 'configure' event arrive
 
22
                
 
23
                props = self.d.GetProperties('type=Dock')
 
24
                height = props[0]['height']
 
25
                
 
26
                if height == height_ini:
 
27
                        self.print_error ('The dock size has not been updated')
 
28
                elif height != height_ini - 1:
 
29
                        self.print_error ('The dock height is wrong (should be %d but is %d)' % (height_ini - 1, height))
 
30
                
 
31
                set_param (self.get_conf_file(), "Background", "line width", "2")  # back to normal
 
32
                set_param (self.get_conf_file(), "Position", "screen border", "1")  # from bottom to top
 
33
                
 
34
                self.d.Reload('type=Manager & name='+self.mgr)
 
35
                sleep(self.dt)  # let the 'configure' event arrive
 
36
                props = self.d.GetProperties('type=Dock')
 
37
                y = props[0]['y']
 
38
                
 
39
                if y_ini == y:
 
40
                        self.print_error ('The dock position has not been updated')
 
41
                elif y != 0:
 
42
                        print ("incorrect position (should be 0 but is %d)", y);
 
43
                
 
44
                set_param (self.get_conf_file(), "Position", "screen border", "0")  # back to normal
 
45
                self.d.Reload('type=Manager & name='+self.mgr)
 
46
                
 
47
                self.end()