summaryrefslogtreecommitdiff
path: root/tests/functional/test13.py
blob: b5a912b772c2902fb4f768a5bc0fc32427ea8e8f (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
55
56
#!/usr/bin/python

# Check that _NET_WM_STATE_FULLSCREEN in _NET_WM_STATE is respected.

#* Test steps
#  * show a non-fullscreen application window
#  * request _NET_WM_STATE _NET_WM_STATE_FULLSCREEN for the window
#* Post-conditions
#  * verify that the window now has fullscreen size

import os, re, sys, time

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

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

def get_window_size(w):
  ret = [0, 0]
  size_re = re.compile('([0-9]+)x([0-9]+)x([0-9]+)')
  fd = os.popen('windowstack v')
  s = fd.read(5000)
  for l in s.splitlines():
    if re.search("%s " % w, l.strip()):
      ret[0] = int(size_re.search(l.strip()).group(1))
      ret[1] = int(size_re.search(l.strip()).group(2))
      break
  return ret

(fs_w, fs_h) = (864, 480)

# map non-fullscreen application window
fd = os.popen('windowctl n')
old_win = fd.readline().strip()
time.sleep(1)
ret = 0
size = get_window_size(old_win)
if size[0] == fs_w and size[1] == fs_h:
  print 'FAIL: old_win is fullscreen'
  ret = 1

# fullscreen the application window
os.popen('windowctl F %s' % old_win)
time.sleep(1)
size = get_window_size(old_win)
if size[0] != fs_w or size[1] != fs_h:
  print 'FAIL: old_win is not fullscreen'
  ret = 1

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

sys.exit(ret)