Skip to content

Add regression test for duplicate on_scroll on Windows - #677

Open
mxschmitt wants to merge 1 commit into
moses-palmer:masterfrom
mxschmitt:fixup/win32-remove-duplicate-emits-test
Open

Add regression test for duplicate on_scroll on Windows#677
mxschmitt wants to merge 1 commit into
moses-palmer:masterfrom
mxschmitt:fixup/win32-remove-duplicate-emits-test

Conversation

@mxschmitt

Copy link
Copy Markdown

Summary

Adds a regression test for #672. Asserts that Controller.scroll(0, 1) produces exactly one on_scroll callback within a 0.5s window — not two — and is intended to land alongside the fix on this branch.

Verification

Run on Windows 11 (Python 3.13) against three pynput sources:

Source Result
pynput==1.8.1 (PyPI) AssertionError: 1 != 2 ... got 2: [(0, 1), (0, 1)]
master (a871765) same — fails (2 events)
this branch (with fix) passes (1 event)
$ python -m unittest tests.mouse_controller_tests.MouseControllerTest.test_scroll_no_duplicate -v
test_scroll_no_duplicate ... ok
Ran 1 test in 4.711s
OK

The test reuses existing test infrastructure (self.listener, self.controller) and is platform-agnostic — it should also pass on macOS/Xorg where the bug never existed.

Verifies that a single Controller.scroll() call results in a single
on_scroll callback. Previously on Windows two events were delivered:
one from NotifierMixin._emit and one from the WH_MOUSE_LL hook, since
SendInput already reaches the hook.
@mxschmitt
mxschmitt force-pushed the fixup/win32-remove-duplicate-emits-test branch from 1c0314f to 5c627ff Compare May 12, 2026 23:42
@mxschmitt
mxschmitt changed the base branch from fixup/win32-remove-duplicate-emits to master May 12, 2026 23:42
@mxschmitt

Copy link
Copy Markdown
Author

cc @moses-palmer a test for the recent bug which got fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant