Skip to content

Commit dac85ea

Browse files
tryone144yshui
authored andcommittedOct 24, 2020
Add testcase for #394
1 parent 8added4 commit dac85ea

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed
 

‎tests/configs/issue394.conf

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
fading = true;
2+
fade-in-step = 1;
3+
fade-out-step = 0.01;
4+
shadow = true;

‎tests/run_tests.sh

+1
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ eval `dbus-launch --sh-syntax`
1515
./run_one_test.sh $exe configs/issue314.conf testcases/issue314_2.py
1616
./run_one_test.sh $exe configs/issue314.conf testcases/issue314_3.py
1717
./run_one_test.sh $exe /dev/null testcases/issue299.py
18+
./run_one_test.sh $exe configs/issue394.conf testcases/issue394.py

‎tests/testcases/common.py

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ def set_window_class(conn, wid, name):
2828
str_type = to_atom(conn, "STRING")
2929
conn.core.ChangePropertyChecked(xproto.PropMode.Replace, wid, prop_name, str_type, 8, len(name), name).check()
3030

31+
def set_window_size(conn, wid, width, height):
32+
value_mask = xproto.ConfigWindow.Width | xproto.ConfigWindow.Height
33+
value_list = [width, height]
34+
conn.core.ConfigureWindowChecked(wid, value_mask, value_list).check()
35+
3136
def find_picom_window(conn):
3237
prop_name = to_atom(conn, "WM_NAME")
3338
setup = conn.get_setup()

‎tests/testcases/issue394.py

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env python
2+
3+
import xcffib.xproto as xproto
4+
import xcffib
5+
import time
6+
from common import set_window_name, set_window_size
7+
8+
conn = xcffib.connect()
9+
setup = conn.get_setup()
10+
root = setup.roots[0].root
11+
visual = setup.roots[0].root_visual
12+
depth = setup.roots[0].root_depth
13+
14+
# issue 394 is caused by a window getting a size update just before destroying leading to a shadow update on destroyed window.
15+
wid = conn.generate_id()
16+
print("Window id is ", hex(wid))
17+
18+
# Create a window
19+
conn.core.CreateWindowChecked(depth, wid, root, 0, 0, 100, 100, 0, xproto.WindowClass.InputOutput, visual, 0, []).check()
20+
21+
# Set Window name so it doesn't get a shadow
22+
set_window_name(conn, wid, "Test Window")
23+
24+
# Map the window
25+
print("mapping")
26+
conn.core.MapWindowChecked(wid).check()
27+
28+
time.sleep(0.5)
29+
30+
# Resize the window and destroy
31+
print("resize and destroy")
32+
set_window_size(conn, wid, 150, 150)
33+
conn.core.DestroyWindowChecked(wid).check()
34+
35+
time.sleep(0.5)

0 commit comments

Comments
 (0)
Please sign in to comment.