summaryrefslogtreecommitdiff
path: root/tests/functional/test16.py
blob: 80cefdd5d709c1432dad5438301ce77d740bf116 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/python

# Check that initial_state=IconicState is respected in WM_HINTS

#* Test steps
#  * show an application window with initial_state=IconicState
#* Post-conditions
#  * application is stacked under the desktop window

import os, re, sys, time

if os.system('/sbin/mcetool --unblank-screen --set-inhibit-mode=stay-on'):
  print 'mcetool is missing!'

if os.system('pidof mcompositor'):
  print 'mcompositor is not running'
  sys.exit(1)

fd = os.popen('windowstack m')
s = fd.read(5000)
win_re = re.compile('^0x[0-9a-f]+')
home_win = 0
for l in s.splitlines():
  if re.search(' DESKTOP viewable ', l.strip()):
    home_win = win_re.match(l.strip()).group()
    break

if home_win == 0:
  print 'FAIL: desktop not found'
  sys.exit(1)

# create initially iconic application window
fd = os.popen('windowctl In')
old_win = fd.readline().strip()
time.sleep(2)

ret = 0
fd = os.popen('windowstack m')
s = fd.read(5000)
for l in s.splitlines():
  if re.search("%s " % home_win, l.strip()):
    print home_win, 'found'
    break
  elif re.search("%s " % old_win, l.strip()):
    print 'FAIL: application window is not iconic'
    print 'Failed stack:\n', s
    ret = 1
    break

# cleanup
os.popen('pkill windowctl')
time.sleep(1)

sys.exit(ret)