mirror of
https://github.com/yshui/picom.git
synced 2024-11-18 13:55:36 -05:00
tests: update testcase for #314
Handle more (hopefully all) edge-cases when updating `opacity_target_old`: * `MAPPING` transitions to `FADING` if new target is reached. Otherwise no update. * `FADING` clamps to current `opacity` if old target is too small. * `UNMAPPING`/`DESTROYING` clamps to current `opacity` if old target is too small.
This commit is contained in:
parent
cd4913876f
commit
c1d985eb7c
5 changed files with 118 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
|||
fading = true
|
||||
fade-in-step = 1
|
||||
fade-in-step = 0.01
|
||||
fade-out-step = 0.01
|
||||
inactive-opacity = 0
|
||||
blur-background = true
|
||||
|
|
|
@ -10,3 +10,5 @@ cd $(dirname $0)
|
|||
./run_one_test.sh $exe configs/issue239_3.conf testcases/issue239_3.py
|
||||
./run_one_test.sh $exe configs/issue239_3.conf testcases/issue239_3_norefresh.py
|
||||
./run_one_test.sh $exe configs/issue314.conf testcases/issue314.py
|
||||
./run_one_test.sh $exe configs/issue314.conf testcases/issue314_2.py
|
||||
./run_one_test.sh $exe configs/issue314.conf testcases/issue314_3.py
|
||||
|
|
|
@ -12,11 +12,11 @@ visual = setup.roots[0].root_visual
|
|||
depth = setup.roots[0].root_depth
|
||||
x = xproto.xprotoExtension(conn)
|
||||
|
||||
# issue 239 is caused by a window gaining a shadow during its fade-out transition
|
||||
# issue 314 is caused by changing a windows target opacity during its fade-in/-out transition
|
||||
wid1 = conn.generate_id()
|
||||
print("Window 1: ", hex(wid1))
|
||||
wid2 = conn.generate_id()
|
||||
print("Window 1: ", hex(wid2))
|
||||
print("Window 2: ", hex(wid2))
|
||||
|
||||
# Create windows
|
||||
conn.core.CreateWindowChecked(depth, wid1, root, 0, 0, 100, 100, 0, xproto.WindowClass.InputOutput, visual, 0, []).check()
|
||||
|
@ -26,20 +26,19 @@ conn.core.CreateWindowChecked(depth, wid2, root, 0, 0, 100, 100, 0, xproto.Windo
|
|||
set_window_name(conn, wid1, "Test window 1")
|
||||
set_window_name(conn, wid2, "Test window 2")
|
||||
|
||||
print("mapping 1")
|
||||
# Check updating opacity while UNMAPPING/DESTROYING windows
|
||||
print("Mapping 1")
|
||||
conn.core.MapWindowChecked(wid1).check()
|
||||
print("mapping 2")
|
||||
print("Mapping 2")
|
||||
conn.core.MapWindowChecked(wid2).check()
|
||||
|
||||
time.sleep(0.5)
|
||||
|
||||
x.SetInputFocusChecked(0, wid1, xproto.Time.CurrentTime).check()
|
||||
|
||||
time.sleep(0.5)
|
||||
|
||||
# Destroy the windows
|
||||
print("Destroy 1 while fading out")
|
||||
conn.core.DestroyWindowChecked(wid1).check()
|
||||
|
||||
x.SetInputFocusChecked(0, wid2, xproto.Time.CurrentTime).check()
|
||||
time.sleep(1)
|
||||
conn.core.DestroyWindowChecked(wid2).check()
|
||||
|
|
46
tests/testcases/issue314_2.py
Executable file
46
tests/testcases/issue314_2.py
Executable file
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import xcffib.xproto as xproto
|
||||
import xcffib
|
||||
import time
|
||||
from common import set_window_name, trigger_root_configure
|
||||
|
||||
conn = xcffib.connect()
|
||||
setup = conn.get_setup()
|
||||
root = setup.roots[0].root
|
||||
visual = setup.roots[0].root_visual
|
||||
depth = setup.roots[0].root_depth
|
||||
x = xproto.xprotoExtension(conn)
|
||||
|
||||
opacity_80 = [int(0xffffffff * 0.8), ]
|
||||
opacity_single = [int(0xffffffff * 0.002), ]
|
||||
|
||||
# issue 314 is caused by changing a windows target opacity during its fade-in/-out transition
|
||||
wid1 = conn.generate_id()
|
||||
print("Window 1: ", hex(wid1))
|
||||
|
||||
atom = "_NET_WM_WINDOW_OPACITY"
|
||||
opacity_atom = conn.core.InternAtom(False, len(atom), atom).reply().atom
|
||||
|
||||
# Create windows
|
||||
conn.core.CreateWindowChecked(depth, wid1, root, 0, 0, 100, 100, 0, xproto.WindowClass.InputOutput, visual, 0, []).check()
|
||||
|
||||
# Set Window names
|
||||
set_window_name(conn, wid1, "Test window 1")
|
||||
|
||||
# Check updating opacity while MAPPING windows
|
||||
print("Mapping window")
|
||||
conn.core.MapWindowChecked(wid1).check()
|
||||
time.sleep(0.5)
|
||||
|
||||
print("Update opacity while fading in")
|
||||
conn.core.ChangePropertyChecked(xproto.PropMode.Replace, wid1, opacity_atom, xproto.Atom.CARDINAL, 32, 1, opacity_80).check()
|
||||
time.sleep(0.2)
|
||||
conn.core.ChangePropertyChecked(xproto.PropMode.Replace, wid1, opacity_atom, xproto.Atom.CARDINAL, 32, 1, opacity_single).check()
|
||||
time.sleep(1)
|
||||
|
||||
conn.core.DeletePropertyChecked(wid1, opacity_atom).check()
|
||||
time.sleep(0.5)
|
||||
|
||||
# Destroy the windows
|
||||
conn.core.DestroyWindowChecked(wid1).check()
|
63
tests/testcases/issue314_3.py
Executable file
63
tests/testcases/issue314_3.py
Executable file
|
@ -0,0 +1,63 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import xcffib.xproto as xproto
|
||||
import xcffib
|
||||
import time
|
||||
from common import set_window_name, trigger_root_configure
|
||||
|
||||
conn = xcffib.connect()
|
||||
setup = conn.get_setup()
|
||||
root = setup.roots[0].root
|
||||
visual = setup.roots[0].root_visual
|
||||
depth = setup.roots[0].root_depth
|
||||
x = xproto.xprotoExtension(conn)
|
||||
|
||||
opacity_100 = [0xffffffff, ]
|
||||
opacity_80 = [int(0xffffffff * 0.8), ]
|
||||
opacity_single = [int(0xffffffff * 0.002), ]
|
||||
opacity_0 = [0, ]
|
||||
|
||||
# issue 314 is caused by changing a windows target opacity during its fade-in/-out transition
|
||||
wid1 = conn.generate_id()
|
||||
print("Window 1: ", hex(wid1))
|
||||
|
||||
atom = "_NET_WM_WINDOW_OPACITY"
|
||||
opacity_atom = conn.core.InternAtom(False, len(atom), atom).reply().atom
|
||||
|
||||
# Create windows
|
||||
conn.core.CreateWindowChecked(depth, wid1, root, 0, 0, 100, 100, 0, xproto.WindowClass.InputOutput, visual, 0, []).check()
|
||||
|
||||
# Set Window names
|
||||
set_window_name(conn, wid1, "Test window 1")
|
||||
|
||||
# Check updating opacity while FADING windows
|
||||
print("Mapping window")
|
||||
conn.core.MapWindowChecked(wid1).check()
|
||||
time.sleep(1.2)
|
||||
|
||||
print("Update opacity while fading out")
|
||||
conn.core.ChangePropertyChecked(xproto.PropMode.Replace, wid1, opacity_atom, xproto.Atom.CARDINAL, 32, 1, opacity_single).check()
|
||||
time.sleep(0.2)
|
||||
conn.core.ChangePropertyChecked(xproto.PropMode.Replace, wid1, opacity_atom, xproto.Atom.CARDINAL, 32, 1, opacity_0).check()
|
||||
time.sleep(1)
|
||||
|
||||
print("Change from fading in to fading out")
|
||||
conn.core.ChangePropertyChecked(xproto.PropMode.Replace, wid1, opacity_atom, xproto.Atom.CARDINAL, 32, 1, opacity_80).check()
|
||||
time.sleep(0.5)
|
||||
conn.core.ChangePropertyChecked(xproto.PropMode.Replace, wid1, opacity_atom, xproto.Atom.CARDINAL, 32, 1, opacity_0).check()
|
||||
time.sleep(1)
|
||||
|
||||
print("Update opacity while fading in")
|
||||
conn.core.ChangePropertyChecked(xproto.PropMode.Replace, wid1, opacity_atom, xproto.Atom.CARDINAL, 32, 1, opacity_80).check()
|
||||
time.sleep(0.2)
|
||||
conn.core.ChangePropertyChecked(xproto.PropMode.Replace, wid1, opacity_atom, xproto.Atom.CARDINAL, 32, 1, opacity_100).check()
|
||||
time.sleep(1)
|
||||
|
||||
print("Change from fading out to fading in")
|
||||
conn.core.ChangePropertyChecked(xproto.PropMode.Replace, wid1, opacity_atom, xproto.Atom.CARDINAL, 32, 1, opacity_0).check()
|
||||
time.sleep(0.5)
|
||||
conn.core.ChangePropertyChecked(xproto.PropMode.Replace, wid1, opacity_atom, xproto.Atom.CARDINAL, 32, 1, opacity_80).check()
|
||||
time.sleep(1)
|
||||
|
||||
# Destroy the windows
|
||||
conn.core.DestroyWindowChecked(wid1).check()
|
Loading…
Reference in a new issue