3
from Test import Test, key, set_param
4
from CairoDock import CairoDock
7
# test taskbar with grouped windows
8
class TestTaskbar(Test):
9
def __init__(self, dock):
11
self.wmclass = config.wmclass
12
self.desktop_file = config.desktop_file
13
Test.__init__(self, "Test taskbar", dock)
16
# start from 0 instance and check that the launcher is the only icon of this class
17
os.system('killall -q '+self.exe)
19
props = self.d.GetProperties('class='+self.wmclass)
22
self.d.Add({'type':'Launcher', 'config-file':'application://'+self.desktop_file})
24
self.print_error ("Too many icons in the class "+self.wmclass)
26
# launch 1 instance and check that the launcher has taken the window
27
os.system(self.exe+'&')
29
props = self.d.GetProperties('class='+self.wmclass)
30
if len(props) != 1 or props[0]['Xid'] == 0:
31
self.print_error ("The launcher didn't take control of the window")
33
# launch a 2nd instance and check that both windows are grouped above the launcher
34
os.system(self.exe+'&')
37
props = self.d.GetProperties('type=Application & container='+self.wmclass+' & class='+self.wmclass)
39
self.print_error ("Windows have not been grouped together")
41
props = self.d.GetProperties('type=Launcher & class='+self.wmclass)
42
if len(props) == 0 or props[0]['Xid'] != 0:
43
self.print_error ("The launcher should have no indicator")
45
# close 1 window and check that we come back to the previous situation
46
os.system('pgrep -f '+self.exe+' | head -1 | xargs kill')
49
props = self.d.GetProperties('class='+self.wmclass)
50
if len(props) != 1 or props[0]['Xid'] == 0:
51
self.print_error ("The launcher didn't take back control of the window")
53
# close the 2nd window and check that we come back to the first situation
54
os.system('killall -q '+self.exe)
56
props = self.d.GetProperties('class='+self.wmclass)
58
if len(props) != 1 or props[0]['Xid'] != 0:
59
self.print_error ("All windows didn't disappear from the dock")
63
# test taskbar with ungrouped windows
64
class TestTaskbar2(Test):
65
def __init__(self, dock):
67
self.wmclass = config.wmclass
68
self.desktop_file = config.desktop_file
69
Test.__init__(self, "Test taskbar2", dock)
72
set_param (self.get_conf_file(), "TaskBar", "group by class", "false")
73
self.d.Reload('type=Manager & name=Taskbar')
75
# start from 0 instance and check that the launcher is the only icon of this class
76
os.system('killall -q '+self.exe)
78
props = self.d.GetProperties('class='+self.wmclass)
81
self.d.Add({'type':'Launcher', 'config-file':'application://'+self.desktop_file})
83
self.print_error ("Too many icons in the class "+self.wmclass)
85
# launch 1 instance and check that the launcher has taken the window
86
os.system(self.exe+'&')
88
props = self.d.GetProperties('class='+self.wmclass)
89
if len(props) != 1 or props[0]['Xid'] == 0:
90
self.print_error ("The launcher didn't take control of the window")
92
launcher_position = props[0]['position']
94
# launch a 2nd instance and check that the 2nd icon is next to the launcher
95
os.system(self.exe+'&')
98
props = self.d.GetProperties('type=Application & class='+self.wmclass)
100
self.print_error ("There should be an icon for the 2nd window")
102
if props[0]['position'] != launcher_position + 1:
103
self.print_error ("The appli icon should be next to its launcher")
105
# close 1 window and check that we come back to the previous situation
106
os.system('pgrep -f '+self.exe+' | head -1 | xargs kill')
109
props = self.d.GetProperties('class='+self.wmclass)
110
if len(props) != 1 or props[0]['Xid'] == 0:
111
self.print_error ("The launcher didn't take back control of the window")
113
# close the 2nd window and check that we come back to the first situation
114
os.system('killall -q '+self.exe)
116
props = self.d.GetProperties('class='+self.wmclass)
118
if len(props) != 1 or props[0]['Xid'] != 0:
119
self.print_error ("All windows didn't disappear from the dock")
121
set_param (self.get_conf_file(), "TaskBar", "group by class", "true")
122
self.d.Reload('type=Manager & name=Taskbar')