detached 12a6410

test(wayland): prove dropped gesture commands sent nothing by ordering

commit
12a64100642c36ae097e44248c34d19b4e126dea
author
brice · · 2026-10-08 19:54 UTC
parent
034458a
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
1 file · +14 -4
M internal/adapters/wayland/gestures_test.go +14 -4
@@ -140,9 +140,13 @@ func TestPointerGestures(t *testing.T) {
140140 quiet(t, c, swipe)
141141 quiet(t, c, hold)
142142
143- // The pointer leaving the window cancels the gesture.
143+ // The pointer leaving the window cancels the gesture. Commands run in
144+ // order: the next pinch event being this begin proves the dropped
145+ // update above sent nothing.
144146 commands <- ports.GestureBeginTo{ID: w.ID, Kind: ports.GesturePinch, Fingers: 2, Time: 4000 * 1e6}
145- next(t, c, pinch)
147+ if ev := next(t, c, pinch); ev[0] != 0 || ev[2] != 4000 {
148+ t.Fatalf("pinch begin %v", ev)
149+ }
146150 commands <- ports.PointerFocus{}
147151 if ev := next(t, c, pinch); ev[0] != 2 || ev[3] != 1 {
148152 t.Fatalf("pinch not cancelled on leave: %v", ev)
@@ -157,6 +161,12 @@ func TestPointerGestures(t *testing.T) {
157161 if ev := next(t, c, hold); ev[0] != 0 || ev[4] != 4 {
158162 t.Fatalf("hold begin after release %v", ev)
159163 }
164+ // The end after the cancel sent nothing: the next pinch event is this
165+ // begin.
166+ commands <- ports.GestureBeginTo{ID: w.ID, Kind: ports.GesturePinch, Fingers: 2, Time: 6000 * 1e6}
167+ if ev := next(t, c, pinch); ev[0] != 0 || ev[2] != 6000 {
168+ t.Fatalf("pinch begin after cancelled end %v", ev)
169+ }
160170
161171 // The client without the pointer saw nothing.
162172 quiet(t, other, oSwipe)
@@ -164,8 +174,8 @@ func TestPointerGestures(t *testing.T) {
164174 quiet(t, other, oHold)
165175 }
166176
167-// A window with the pointer but no gesture object gets nothing, and a
168-// gesture on a window that does not have the pointer is refused.
177+// A window with the pointer but no gesture object gets gesture commands
178+// without the server failing or the client being disconnected.
169179 func TestPointerGesturesWithoutObjects(t *testing.T) {
170180 s, events, commands, dir := lifecycleServer(t)
171181 c := protocolClient(t, s, dir)
@@ -140,9 +140,13 @@ func TestPointerGestures(t *testing.T) {
140 quiet(t, c, swipe)140 quiet(t, c, swipe)
141 quiet(t, c, hold)141 quiet(t, c, hold)
142 142
143- // The pointer leaving the window cancels the gesture.143+ // The pointer leaving the window cancels the gesture. Commands run in
144+ // order: the next pinch event being this begin proves the dropped
145+ // update above sent nothing.
144 commands <- ports.GestureBeginTo{ID: w.ID, Kind: ports.GesturePinch, Fingers: 2, Time: 4000 * 1e6}146 commands <- ports.GestureBeginTo{ID: w.ID, Kind: ports.GesturePinch, Fingers: 2, Time: 4000 * 1e6}
145- next(t, c, pinch)147+ if ev := next(t, c, pinch); ev[0] != 0 || ev[2] != 4000 {
148+ t.Fatalf("pinch begin %v", ev)
149+ }
146 commands <- ports.PointerFocus{}150 commands <- ports.PointerFocus{}
147 if ev := next(t, c, pinch); ev[0] != 2 || ev[3] != 1 {151 if ev := next(t, c, pinch); ev[0] != 2 || ev[3] != 1 {
148 t.Fatalf("pinch not cancelled on leave: %v", ev)152 t.Fatalf("pinch not cancelled on leave: %v", ev)
@@ -157,6 +161,12 @@ func TestPointerGestures(t *testing.T) {
157 if ev := next(t, c, hold); ev[0] != 0 || ev[4] != 4 {161 if ev := next(t, c, hold); ev[0] != 0 || ev[4] != 4 {
158 t.Fatalf("hold begin after release %v", ev)162 t.Fatalf("hold begin after release %v", ev)
159 }163 }
164+ // The end after the cancel sent nothing: the next pinch event is this
165+ // begin.
166+ commands <- ports.GestureBeginTo{ID: w.ID, Kind: ports.GesturePinch, Fingers: 2, Time: 6000 * 1e6}
167+ if ev := next(t, c, pinch); ev[0] != 0 || ev[2] != 6000 {
168+ t.Fatalf("pinch begin after cancelled end %v", ev)
169+ }
160 170
161 // The client without the pointer saw nothing.171 // The client without the pointer saw nothing.
162 quiet(t, other, oSwipe)172 quiet(t, other, oSwipe)
@@ -164,8 +174,8 @@ func TestPointerGestures(t *testing.T) {
164 quiet(t, other, oHold)174 quiet(t, other, oHold)
165 }175 }
166 176
167-// A window with the pointer but no gesture object gets nothing, and a177+// A window with the pointer but no gesture object gets gesture commands
168-// gesture on a window that does not have the pointer is refused.178+// without the server failing or the client being disconnected.
169 func TestPointerGesturesWithoutObjects(t *testing.T) {179 func TestPointerGesturesWithoutObjects(t *testing.T) {
170 s, events, commands, dir := lifecycleServer(t)180 s, events, commands, dir := lifecycleServer(t)
171 c := protocolClient(t, s, dir)181 c := protocolClient(t, s, dir)

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 23

Tags 10

↑↓ moveenter openesc close