diff --git a/tests/configs/issue314.conf b/tests/configs/issue314.conf index ce71a3e..bb3c4cb 100644 --- a/tests/configs/issue314.conf +++ b/tests/configs/issue314.conf @@ -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 diff --git a/tests/run_tests.sh b/tests/run_tests.sh index 53292ca..9f3c9e4 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -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 diff --git a/tests/testcases/issue314.py b/tests/testcases/issue314.py index de7226b..ee29fc4 100755 --- a/tests/testcases/issue314.py +++ b/tests/testcases/issue314.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() diff --git a/tests/testcases/issue314_2.py b/tests/testcases/issue314_2.py new file mode 100755 index 0000000..01192de --- /dev/null +++ b/tests/testcases/issue314_2.py @@ -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() diff --git a/tests/testcases/issue314_3.py b/tests/testcases/issue314_3.py new file mode 100755 index 0000000..8e5d62d --- /dev/null +++ b/tests/testcases/issue314_3.py @@ -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()