| @@ -0,0 +1,374 @@ |
| 1 | + | package wayland |
| 2 | + | |
| 3 | + | import ( |
| 4 | + | "testing" |
| 5 | + | |
| 6 | + | "bnema.dev/wlturbo" |
| 7 | + | "github.com/bnema/go-wayland-bindings/server/wayland" |
| 8 | + | "github.com/bnema/go-wayland-bindings/server/wlrvirtualpointer" |
| 9 | + | "github.com/bnema/neferwl/internal/domain" |
| 10 | + | "github.com/bnema/neferwl/internal/ports" |
| 11 | + | ) |
| 12 | + | |
| 13 | + | // virtualMover binds a virtual pointer on its own connection, as wlrctl |
| 14 | + | // does; withOutput uses create_virtual_pointer_with_output on wl_output. |
| 15 | + | func virtualMover(t *testing.T, s *Server, dir string, withOutput bool) (*wlturbo.Display, uint32) { |
| 16 | + | t.Helper() |
| 17 | + | c := protocolClient(t, s, dir) |
| 18 | + | seat := bindProtocol(t, c, "wl_seat") |
| 19 | + | registerProtocol(t, c, seat) |
| 20 | + | manager := bindVersion(t, c, virtualPointerInterface, 2) |
| 21 | + | registerProtocol(t, c, manager) |
| 22 | + | if withOutput { |
| 23 | + | out := bindVersion(t, c, "wl_output", 4) |
| 24 | + | registerProtocol(t, c, out) |
| 25 | + | p := c.AllocateID() |
| 26 | + | registerProtocol(t, c, p) |
| 27 | + | requestProtocol(t, c, manager, wlrvirtualpointer.ZwlrVirtualPointerManagerV1RequestCreateVirtualPointerWithOutput, seat, out, p) |
| 28 | + | return c, p |
| 29 | + | } |
| 30 | + | p := c.AllocateID() |
| 31 | + | registerProtocol(t, c, p) |
| 32 | + | requestProtocol(t, c, manager, wlrvirtualpointer.ZwlrVirtualPointerManagerV1RequestCreateVirtualPointer, seat, p) |
| 33 | + | return c, p |
| 34 | + | } |
| 35 | + | |
| 36 | + | func fixed(v float64) wlturbo.Fixed { return wlturbo.Fixed(int32(v * 256)) } |
| 37 | + | |
| 38 | + | // virtualEvents waits for n VirtualPointerInput events after a roundtrip |
| 39 | + | // and fails on any further one already forwarded. |
| 40 | + | func virtualEvents(t *testing.T, c *wlturbo.Display, events chan ports.ClientEvent, n int) []ports.VirtualPointerInput { |
| 41 | + | t.Helper() |
| 42 | + | roundtrip(t, c) |
| 43 | + | var out []ports.VirtualPointerInput |
| 44 | + | for len(out) < n { |
| 45 | + | out = append(out, nextEvent[ports.VirtualPointerInput](t, events)) |
| 46 | + | } |
| 47 | + | for { |
| 48 | + | select { |
| 49 | + | case ev := <-events: |
| 50 | + | if v, ok := ev.(ports.VirtualPointerInput); ok { |
| 51 | + | t.Fatalf("unexpected virtual event %+v", v) |
| 52 | + | } |
| 53 | + | default: |
| 54 | + | return out |
| 55 | + | } |
| 56 | + | } |
| 57 | + | } |
| 58 | + | |
| 59 | + | // Requests are held until frame and reach core in one batch: motion, then |
| 60 | + | // buttons, then scroll, under the virtual device identity. |
| 61 | + | func TestVirtualPointerFrameBatch(t *testing.T) { |
| 62 | + | s, events, _, dir := keyboardServer(t) |
| 63 | + | c, p := virtualMover(t, s, dir, false) |
| 64 | + | requestProtocol(t, c, p, wlrvirtualpointer.ZwlrVirtualPointerV1RequestMotion, uint32(5), fixed(10), fixed(-4)) |
| 65 | + | requestProtocol(t, c, p, wlrvirtualpointer.ZwlrVirtualPointerV1RequestMotion, uint32(6), fixed(2.5), fixed(1)) |
| 66 | + | requestProtocol(t, c, p, wlrvirtualpointer.ZwlrVirtualPointerV1RequestButton, uint32(7), uint32(0x110), uint32(1)) |
| 67 | + | requestProtocol(t, c, p, wlrvirtualpointer.ZwlrVirtualPointerV1RequestAxisSource, uint32(0)) |
| 68 | + | requestProtocol(t, c, p, wlrvirtualpointer.ZwlrVirtualPointerV1RequestAxisDiscrete, uint32(8), uint32(0), fixed(15), int32(1)) |
| 69 | + | roundtrip(t, c) |
| 70 | + | select { |
| 71 | + | case ev := <-events: |
| 72 | + | if _, ok := ev.(ports.VirtualPointerInput); ok { |
| 73 | + | t.Fatal("virtual event before frame") |
| 74 | + | } |
| 75 | + | default: |
| 76 | + | } |
| 77 | + | requestProtocol(t, c, p, wlrvirtualpointer.ZwlrVirtualPointerV1RequestFrame) |
| 78 | + | got := virtualEvents(t, c, events, 3) |
| 79 | + | m, ok := got[0].Event.(ports.PointerMotion) |
| 80 | + | if !ok || got[0].Absolute || m.DX != 12.5 || m.DY != -3 || m.Device < virtualPointerDevices { |
| 81 | + | t.Fatalf("motion %+v", got[0]) |
| 82 | + | } |
| 83 | + | b, ok := got[1].Event.(ports.PointerButton) |
| 84 | + | if !ok || b.Button != 0x110 || !b.Pressed || b.Device != m.Device { |
| 85 | + | t.Fatalf("button %+v", got[1]) |
| 86 | + | } |
| 87 | + | a, ok := got[2].Event.(ports.PointerAxis) |
| 88 | + | if !ok || a.Source != domain.AxisWheel || !a.Vertical.Set || a.Vertical.Value != 15 || a.Vertical.V120 != 120 || a.Horizontal.Set { |
| 89 | + | t.Fatalf("axis %+v", got[2]) |
| 90 | + | } |
| 91 | + | } |
| 92 | + | |
| 93 | + | // Absolute motion becomes a fraction of the layout, or of the bound output. |
| 94 | + | func TestVirtualPointerAbsolute(t *testing.T) { |
| 95 | + | for _, withOutput := range []bool{false, true} { |
| 96 | + | t.Run(map[bool]string{false: "layout", true: "with-output"}[withOutput], func(t *testing.T) { |
| 97 | + | s, events, _, dir := keyboardServer(t) |
| 98 | + | c, p := virtualMover(t, s, dir, withOutput) |
| 99 | + | requestProtocol(t, c, p, wlrvirtualpointer.ZwlrVirtualPointerV1RequestMotionAbsolute, uint32(1), uint32(480), uint32(270), uint32(1920), uint32(1080)) |
| 100 | + | requestProtocol(t, c, p, wlrvirtualpointer.ZwlrVirtualPointerV1RequestFrame) |
| 101 | + | got := virtualEvents(t, c, events, 1)[0] |
| 102 | + | want := "" |
| 103 | + | if withOutput { |
| 104 | + | want = "HEADLESS-1" |
| 105 | + | } |
| 106 | + | if !got.Absolute || got.FX != 0.25 || got.FY != 0.25 || got.Output != want { |
| 107 | + | t.Fatalf("absolute %+v", got) |
| 108 | + | } |
| 109 | + | requestProtocol(t, c, p, wlrvirtualpointer.ZwlrVirtualPointerV1RequestMotion, uint32(2), fixed(5), fixed(3)) |
| 110 | + | requestProtocol(t, c, p, wlrvirtualpointer.ZwlrVirtualPointerV1RequestButton, uint32(2), uint32(0x110), uint32(1)) |
| 111 | + | requestProtocol(t, c, p, wlrvirtualpointer.ZwlrVirtualPointerV1RequestFrame) |
| 112 | + | for _, event := range virtualEvents(t, c, events, 2) { |
| 113 | + | if event.Output != want { |
| 114 | + | t.Fatalf("lost output association: %+v", event) |
| 115 | + | } |
| 116 | + | } |
| 117 | + | }) |
| 118 | + | } |
| 119 | + | } |
| 120 | + | |
| 121 | + | // Losing the pointer mid-click releases its buttons; an unpaired release |
| 122 | + | // never goes out. |
| 123 | + | func TestVirtualPointerDisconnectReleases(t *testing.T) { |
| 124 | + | s, events, _, dir := keyboardServer(t) |
| 125 | + | c, p := virtualMover(t, s, dir, false) |
| 126 | + | requestProtocol(t, c, p, wlrvirtualpointer.ZwlrVirtualPointerV1RequestButton, uint32(1), uint32(0x111), uint32(0)) |
| 127 | + | requestProtocol(t, c, p, wlrvirtualpointer.ZwlrVirtualPointerV1RequestButton, uint32(1), uint32(0x110), uint32(1)) |
| 128 | + | requestProtocol(t, c, p, wlrvirtualpointer.ZwlrVirtualPointerV1RequestFrame) |
| 129 | + | if b := virtualEvents(t, c, events, 1)[0].Event.(ports.PointerButton); b.Button != 0x110 || !b.Pressed { |
| 130 | + | t.Fatalf("press %+v", b) |
| 131 | + | } |
| 132 | + | _ = c.Close() |
| 133 | + | b, ok := nextEvent[ports.VirtualPointerInput](t, events).Event.(ports.PointerButton) |
| 134 | + | if !ok || b.Button != 0x110 || b.Pressed { |
| 135 | + | t.Fatalf("release on disconnect %+v", b) |
| 136 | + | } |
| 137 | + | } |
| 138 | + | |
| 139 | + | // Bad axis values are protocol errors. |
| 140 | + | func TestVirtualPointerInvalidAxis(t *testing.T) { |
| 141 | + | s, _, _, dir := keyboardServer(t) |
| 142 | + | c, p := virtualMover(t, s, dir, false) |
| 143 | + | requestProtocol(t, c, p, wlrvirtualpointer.ZwlrVirtualPointerV1RequestAxis, uint32(1), uint32(7), fixed(1)) |
| 144 | + | expectProtocolError(t, c, p, uint32(wlrvirtualpointer.ZwlrVirtualPointerV1ErrorInvalidAxis)) |
| 145 | + | } |
| 146 | + | |
| 147 | + | // While protected nothing is injected, the frame in progress is dropped and |
| 148 | + | // a press from before the lock is not released into the locked session. |
| 149 | + | func TestProtectedVirtualPointer(t *testing.T) { |
| 150 | + | s, events, _, dir := keyboardServer(t) |
| 151 | + | state := installSecurity(t, s) |
| 152 | + | c, p := virtualMover(t, s, dir, false) |
| 153 | + | requestProtocol(t, c, p, wlrvirtualpointer.ZwlrVirtualPointerV1RequestButton, uint32(1), uint32(0x110), uint32(1)) |
| 154 | + | requestProtocol(t, c, p, wlrvirtualpointer.ZwlrVirtualPointerV1RequestFrame) |
| 155 | + | virtualEvents(t, c, events, 1) |
| 156 | + | requestProtocol(t, c, p, wlrvirtualpointer.ZwlrVirtualPointerV1RequestMotion, uint32(2), fixed(5), fixed(5)) |
| 157 | + | roundtrip(t, c) |
| 158 | + | protect(t, s, state, 1, true) |
| 159 | + | requestProtocol(t, c, p, wlrvirtualpointer.ZwlrVirtualPointerV1RequestMotion, uint32(3), fixed(5), fixed(5)) |
| 160 | + | requestProtocol(t, c, p, wlrvirtualpointer.ZwlrVirtualPointerV1RequestButton, uint32(3), uint32(0x110), uint32(0)) |
| 161 | + | requestProtocol(t, c, p, wlrvirtualpointer.ZwlrVirtualPointerV1RequestFrame) |
| 162 | + | virtualEvents(t, c, events, 0) |
| 163 | + | protect(t, s, state, 2, false) |
| 164 | + | // The old press died with the epoch: its release is not paired. |
| 165 | + | requestProtocol(t, c, p, wlrvirtualpointer.ZwlrVirtualPointerV1RequestButton, uint32(4), uint32(0x110), uint32(0)) |
| 166 | + | requestProtocol(t, c, p, wlrvirtualpointer.ZwlrVirtualPointerV1RequestFrame) |
| 167 | + | virtualEvents(t, c, events, 0) |
| 168 | + | requestProtocol(t, c, p, wlrvirtualpointer.ZwlrVirtualPointerV1RequestMotion, uint32(5), fixed(1), fixed(0)) |
| 169 | + | requestProtocol(t, c, p, wlrvirtualpointer.ZwlrVirtualPointerV1RequestFrame) |
| 170 | + | if got := virtualEvents(t, c, events, 1)[0]; got.State.Generation != 2 || got.State.Protected { |
| 171 | + | t.Fatalf("post-unlock state %+v", got.State) |
| 172 | + | } |
| 173 | + | } |
| 174 | + | |
| 175 | + | // Sandboxed clients do not see the manager global. |
| 176 | + | func TestVirtualPointerHiddenFromSandbox(t *testing.T) { |
| 177 | + | h := newAdmissionHarness(t, 4) |
| 178 | + | plain := protocolClient(t, h.s, h.dir) |
| 179 | + | if _, ok := plain.Registry().FindGlobal(virtualPointerInterface); !ok { |
| 180 | + | t.Fatal("plain client lacks the virtual pointer global") |
| 181 | + | } |
| 182 | + | l := newSandboxListener(t) |
| 183 | + | cc := newContextClient(t, h) |
| 184 | + | cc.commit(t, l, "org.flatpak", "org.example.App") |
| 185 | + | sandboxed := l.connect(t) |
| 186 | + | if _, ok := sandboxed.Registry().FindGlobal(virtualPointerInterface); ok { |
| 187 | + | t.Fatal("sandboxed client sees the virtual pointer global") |
| 188 | + | } |
| 189 | + | } |
| 190 | + | |
| 191 | + | const ( |
| 192 | + | vpMotion = wlrvirtualpointer.ZwlrVirtualPointerV1RequestMotion |
| 193 | + | vpAbsolute = wlrvirtualpointer.ZwlrVirtualPointerV1RequestMotionAbsolute |
| 194 | + | vpButton = wlrvirtualpointer.ZwlrVirtualPointerV1RequestButton |
| 195 | + | vpFrame = wlrvirtualpointer.ZwlrVirtualPointerV1RequestFrame |
| 196 | + | btnLeftCode = uint32(0x110) |
| 197 | + | ) |
| 198 | + | |
| 199 | + | // An unframed release is discarded on disconnect: the forwarded press is |
| 200 | + | // still released exactly once. |
| 201 | + | func TestVirtualPointerUnframedReleaseThenDisconnect(t *testing.T) { |
| 202 | + | s, events, _, dir := keyboardServer(t) |
| 203 | + | c, p := virtualMover(t, s, dir, false) |
| 204 | + | requestProtocol(t, c, p, vpButton, uint32(1), btnLeftCode, uint32(1)) |
| 205 | + | requestProtocol(t, c, p, vpFrame) |
| 206 | + | virtualEvents(t, c, events, 1) |
| 207 | + | requestProtocol(t, c, p, vpButton, uint32(2), btnLeftCode, uint32(0)) |
| 208 | + | virtualEvents(t, c, events, 0) |
| 209 | + | _ = c.Close() |
| 210 | + | b := nextEvent[ports.VirtualPointerInput](t, events).Event.(ports.PointerButton) |
| 211 | + | if b.Button != btnLeftCode || b.Pressed { |
| 212 | + | t.Fatalf("release %+v", b) |
| 213 | + | } |
| 214 | + | if !s.display.Do(func() {}) { |
| 215 | + | t.Fatal("display stopped") |
| 216 | + | } |
| 217 | + | select { |
| 218 | + | case ev := <-events: |
| 219 | + | if v, ok := ev.(ports.VirtualPointerInput); ok { |
| 220 | + | t.Fatalf("extra event %+v", v) |
| 221 | + | } |
| 222 | + | default: |
| 223 | + | } |
| 224 | + | } |
| 225 | + | |
| 226 | + | // Every forwarded held button is released at destroy; a button pressed |
| 227 | + | // only in an unframed request is not. |
| 228 | + | func TestVirtualPointerReleasesAllHeld(t *testing.T) { |
| 229 | + | s, events, _, dir := keyboardServer(t) |
| 230 | + | c, p := virtualMover(t, s, dir, false) |
| 231 | + | for _, b := range []uint32{0x110, 0x111, 0x112} { |
| 232 | + | requestProtocol(t, c, p, vpButton, uint32(1), b, uint32(1)) |
| 233 | + | } |
| 234 | + | requestProtocol(t, c, p, vpFrame) |
| 235 | + | virtualEvents(t, c, events, 3) |
| 236 | + | requestProtocol(t, c, p, vpButton, uint32(2), uint32(0x113), uint32(1)) |
| 237 | + | requestProtocol(t, c, p, wlrvirtualpointer.ZwlrVirtualPointerV1RequestDestroy) |
| 238 | + | got := map[uint32]bool{} |
| 239 | + | for _, v := range virtualEvents(t, c, events, 3) { |
| 240 | + | b := v.Event.(ports.PointerButton) |
| 241 | + | if b.Pressed { |
| 242 | + | t.Fatalf("press on destroy %+v", b) |
| 243 | + | } |
| 244 | + | got[b.Button] = true |
| 245 | + | } |
| 246 | + | if !got[0x110] || !got[0x111] || !got[0x112] { |
| 247 | + | t.Fatalf("released %v", got) |
| 248 | + | } |
| 249 | + | } |
| 250 | + | |
| 251 | + | // Repeated presses in one frame forward once; a frame over the limit is a |
| 252 | + | // wl_display implementation error (object 1, code 3) and forwards nothing. |
| 253 | + | func TestVirtualPointerFrameLimit(t *testing.T) { |
| 254 | + | s, events, _, dir := keyboardServer(t) |
| 255 | + | c, p := virtualMover(t, s, dir, false) |
| 256 | + | for i := 0; i < 10; i++ { |
| 257 | + | requestProtocol(t, c, p, vpButton, uint32(i), btnLeftCode, uint32(1)) |
| 258 | + | } |
| 259 | + | requestProtocol(t, c, p, vpFrame) |
| 260 | + | if got := virtualEvents(t, c, events, 1); len(got) != 1 { |
| 261 | + | t.Fatalf("repeated presses %v", got) |
| 262 | + | } |
| 263 | + | c2, p2 := virtualMover(t, s, dir, false) |
| 264 | + | for i := 0; i <= maxVirtualFrame; i++ { |
| 265 | + | requestProtocol(t, c2, p2, vpButton, uint32(i), btnLeftCode, uint32(i%2)) |
| 266 | + | } |
| 267 | + | expectProtocolError(t, c2, 1, uint32(wayland.DisplayErrorImplementation)) |
| 268 | + | if !s.display.Do(func() {}) { |
| 269 | + | t.Fatal("display stopped") |
| 270 | + | } |
| 271 | + | select { |
| 272 | + | case ev := <-events: |
| 273 | + | if v, ok := ev.(ports.VirtualPointerInput); ok { |
| 274 | + | t.Fatalf("oversized frame forwarded %+v", v) |
| 275 | + | } |
| 276 | + | default: |
| 277 | + | } |
| 278 | + | } |
| 279 | + | |
| 280 | + | // An oversized frame buffer is not kept after the frame. |
| 281 | + | func TestVirtualPointerResetDropsLargeBuffer(t *testing.T) { |
| 282 | + | p := &virtualPointer{pending: make([]ports.VirtualPointerInput, 100)} |
| 283 | + | p.reset() |
| 284 | + | if p.pending != nil { |
| 285 | + | t.Fatalf("kept cap %d", cap(p.pending)) |
| 286 | + | } |
| 287 | + | p.pending = make([]ports.VirtualPointerInput, 3, virtualFrameKeep) |
| 288 | + | p.reset() |
| 289 | + | if len(p.pending) != 0 || cap(p.pending) != virtualFrameKeep { |
| 290 | + | t.Fatalf("small buffer len %d cap %d", len(p.pending), cap(p.pending)) |
| 291 | + | } |
| 292 | + | } |
| 293 | + | |
| 294 | + | // x == extent and an extent of 1 normalize into [0, 1]. |
| 295 | + | func TestVirtualPointerAbsoluteEdges(t *testing.T) { |
| 296 | + | s, events, _, dir := keyboardServer(t) |
| 297 | + | c, p := virtualMover(t, s, dir, false) |
| 298 | + | for _, tc := range []struct { |
| 299 | + | x, ext uint32 |
| 300 | + | want float64 |
| 301 | + | }{{1, 1, 1}, {0, 1, 0}, {1920, 1920, 1}, {5000, 1920, 1}} { |
| 302 | + | requestProtocol(t, c, p, vpAbsolute, uint32(1), tc.x, tc.x, tc.ext, tc.ext) |
| 303 | + | requestProtocol(t, c, p, vpFrame) |
| 304 | + | if got := virtualEvents(t, c, events, 1)[0]; got.FX != tc.want || got.FY != tc.want { |
| 305 | + | t.Fatalf("x %d extent %d: %v,%v want %v", tc.x, tc.ext, got.FX, got.FY, tc.want) |
| 306 | + | } |
| 307 | + | } |
| 308 | + | } |
| 309 | + | |
| 310 | + | // Mixed absolute and relative motion keeps its order and goes out only at |
| 311 | + | // frame, in both directions. |
| 312 | + | func TestVirtualPointerMixedMotionWaitsForFrame(t *testing.T) { |
| 313 | + | for _, absFirst := range []bool{true, false} { |
| 314 | + | t.Run(map[bool]string{true: "abs-rel", false: "rel-abs"}[absFirst], func(t *testing.T) { |
| 315 | + | s, events, _, dir := keyboardServer(t) |
| 316 | + | c, p := virtualMover(t, s, dir, false) |
| 317 | + | abs := func() { requestProtocol(t, c, p, vpAbsolute, uint32(1), uint32(1), uint32(1), uint32(4), uint32(4)) } |
| 318 | + | rel := func() { requestProtocol(t, c, p, vpMotion, uint32(1), fixed(3), fixed(4)) } |
| 319 | + | if absFirst { |
| 320 | + | abs() |
| 321 | + | rel() |
| 322 | + | rel() |
| 323 | + | } else { |
| 324 | + | rel() |
| 325 | + | abs() |
| 326 | + | } |
| 327 | + | virtualEvents(t, c, events, 0) |
| 328 | + | requestProtocol(t, c, p, vpFrame) |
| 329 | + | got := virtualEvents(t, c, events, 2) |
| 330 | + | if got[0].Absolute != absFirst || got[1].Absolute == absFirst { |
| 331 | + | t.Fatalf("order %+v", got) |
| 332 | + | } |
| 333 | + | rv := got[1] |
| 334 | + | if !absFirst { |
| 335 | + | rv = got[0] |
| 336 | + | } |
| 337 | + | m := rv.Event.(ports.PointerMotion) |
| 338 | + | want := 3.0 |
| 339 | + | if absFirst { |
| 340 | + | want = 6 |
| 341 | + | } |
| 342 | + | if m.DX != want { |
| 343 | + | t.Fatalf("relative %+v want dx %v", m, want) |
| 344 | + | } |
| 345 | + | }) |
| 346 | + | } |
| 347 | + | } |
| 348 | + | |
| 349 | + | // Held buttons are bounded across valid frames: presses past the limit and |
| 350 | + | // codes outside the evdev button range are dropped, the pointer stays usable. |
| 351 | + | func TestVirtualPointerHeldLimit(t *testing.T) { |
| 352 | + | s, events, _, dir := keyboardServer(t) |
| 353 | + | c, p := virtualMover(t, s, dir, false) |
| 354 | + | for i := uint32(0); i < maxVirtualHeld+4; i++ { |
| 355 | + | requestProtocol(t, c, p, vpButton, i, 0x100+i, uint32(1)) |
| 356 | + | requestProtocol(t, c, p, vpFrame) |
| 357 | + | } |
| 358 | + | if got := virtualEvents(t, c, events, maxVirtualHeld); len(got) != maxVirtualHeld { |
| 359 | + | t.Fatalf("forwarded %d presses", len(got)) |
| 360 | + | } |
| 361 | + | for _, b := range []uint32{0, 0xff, 0x152, 0xffffffff} { |
| 362 | + | requestProtocol(t, c, p, vpButton, uint32(1), b, uint32(1)) |
| 363 | + | } |
| 364 | + | requestProtocol(t, c, p, vpFrame) |
| 365 | + | virtualEvents(t, c, events, 0) |
| 366 | + | // A release frees a slot for a new press. |
| 367 | + | requestProtocol(t, c, p, vpButton, uint32(2), uint32(0x100), uint32(0)) |
| 368 | + | requestProtocol(t, c, p, vpButton, uint32(2), uint32(0x151), uint32(1)) |
| 369 | + | requestProtocol(t, c, p, vpFrame) |
| 370 | + | got := virtualEvents(t, c, events, 2) |
| 371 | + | if b := got[1].Event.(ports.PointerButton); b.Button != 0x151 || !b.Pressed { |
| 372 | + | t.Fatalf("press after release %+v", b) |
| 373 | + | } |
| 374 | + | } |