Skip to content

Commit

Permalink
tests: add a repro for #1091
Browse files Browse the repository at this point in the history
Signed-off-by: Yuxuan Shui <[email protected]>
  • Loading branch information
yshui committed Feb 19, 2024
1 parent 23e4c68 commit 6a019a4
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/configs/pull1091.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
unredir-if-possible = true;
1 change: 1 addition & 0 deletions tests/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ eval `dbus-launch --sh-syntax`
./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
./run_one_test.sh $exe configs/issue239.conf testcases/issue525.py
./run_one_test.sh $exe configs/pull1091.conf testcases/pull1091.py
4 changes: 4 additions & 0 deletions tests/testcases/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ def set_window_size_async(conn, wid, width, height):
value_list = [width, height]
return conn.core.ConfigureWindowChecked(wid, value_mask, value_list)

def set_window_bypass_compositor(conn, wid, value = 1):
prop_name = to_atom(conn, "_NET_WM_BYPASS_COMPOSITOR")
return conn.core.ChangePropertyChecked(xproto.PropMode.Replace, wid, prop_name, xproto.Atom.CARDINAL, 32, 1, [value])

def find_picom_window(conn):
prop_name = to_atom(conn, "WM_NAME")
setup = conn.get_setup()
Expand Down
42 changes: 42 additions & 0 deletions tests/testcases/pull1091.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env python3

import xcffib.xproto as xproto
import xcffib
from common import *

conn = xcffib.connect()
setup = conn.get_setup()
root = setup.roots[0].root
visual = setup.roots[0].root_visual
depth = setup.roots[0].root_depth

selection_name = "_NET_WM_CM_S0"
selection = conn.core.InternAtom(0, len(selection_name), selection_name).reply().atom

# assertion failure mentioned in 1091 happens when a root change happens right after we
# redirected the screen, before we have even rendered a single frame
wid = conn.generate_id()
print("Window id is ", hex(wid))

# Create a window
conn.core.CreateWindowChecked(depth, wid, root, 0, 0, 100, 100, 0, xproto.WindowClass.InputOutput, visual, 0, []).check()

# Map the window
print("mapping")
conn.core.MapWindowChecked(wid).check()

time.sleep(0.5)

for i in range(0, 100):
set_window_bypass_compositor(conn, wid)

time.sleep(0.5)

set_window_bypass_compositor(conn, wid, 0)
reply, mode, output = prepare_root_configure(conn)

time.sleep(0.2)
r = conn.core.GetSelectionOwner(selection).reply()
if r.owner == 0:
# picom died
break

0 comments on commit 6a019a4

Please sign in to comment.