testcase: add redirect_when_unmapped_window_has_shadow

While working on this PR, I introduced a bug where shadow images for
unmapped windows aren't properly recreated after unredirect/redirect.

The shadow image is freed during unredirect, OTOH redirect only set
IMAGE_STALE flags for mapped window, thus the shadow images for unmapped
windows will be missing.

This bug is already fixed in the previous commit. But the testcase is
good to keep nonetheless.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2020-11-27 20:35:09 +00:00
parent a56d66b4f3
commit 2d54942295
No known key found for this signature in database
GPG Key ID: D3A4405BE6CC17F4
2 changed files with 66 additions and 0 deletions

View File

@ -17,4 +17,5 @@ eval `dbus-launch --sh-syntax`
./run_one_test.sh $exe /dev/null testcases/issue299.py
./run_one_test.sh $exe configs/issue465.conf testcases/issue465.py
./run_one_test.sh $exe configs/clear_shadow_unredirected.conf testcases/clear_shadow_unredirected.py
./run_one_test.sh $exe configs/clear_shadow_unredirected.conf testcases/redirect_when_unmapped_window_has_shadow.py
./run_one_test.sh $exe configs/issue394.conf testcases/issue394.py

View File

@ -0,0 +1,65 @@
#!/usr/bin/env python
import xcffib.xproto as xproto
import xcffib
import time
from common import set_window_name
conn = xcffib.connect()
setup = conn.get_setup()
root = setup.roots[0].root
visual = setup.roots[0].root_visual
depth = setup.roots[0].root_depth
name = "_NET_WM_STATE"
name_atom = conn.core.InternAtom(False, len(name), name).reply().atom
atom = "ATOM"
atom_atom = conn.core.InternAtom(False, len(atom), atom).reply().atom
fs = "_NET_WM_STATE_FULLSCREEN"
fs_atom = conn.core.InternAtom(False, len(fs), fs).reply().atom
wid1 = conn.generate_id()
print("Window 1 id is ", hex(wid1))
# Create a window
conn.core.CreateWindowChecked(depth, wid1, root, 0, 0, 100, 100, 0, xproto.WindowClass.InputOutput, visual, 0, []).check()
# Map the window
print("mapping 1")
conn.core.MapWindowChecked(wid1).check()
time.sleep(0.5)
print("unmapping 1")
# Unmap the window
conn.core.UnmapWindowChecked(wid1).check()
time.sleep(0.5)
# create and map a second window
wid2 = conn.generate_id()
print("Window 2 id is ", hex(wid2))
conn.core.CreateWindowChecked(depth, wid2, root, 200, 0, 100, 100, 0, xproto.WindowClass.InputOutput, visual, 0, []).check()
print("mapping 2")
conn.core.MapWindowChecked(wid2).check()
time.sleep(0.5)
# Set fullscreen property on the second window, causing screen to be unredirected
conn.core.ChangePropertyChecked(xproto.PropMode.Replace, wid2, name_atom, atom_atom, 32, 1, [fs_atom]).check()
time.sleep(0.5)
# Unset fullscreen property on the second window, causing screen to be redirected
conn.core.ChangePropertyChecked(xproto.PropMode.Replace, wid2, name_atom, atom_atom, 32, 0, []).check()
time.sleep(0.5)
# map the first window again
print("mapping 1")
conn.core.MapWindowChecked(wid1).check()
time.sleep(0.5)
# Destroy the windows
conn.core.DestroyWindowChecked(wid1).check()
conn.core.DestroyWindowChecked(wid2).check()