Repository navigation
Ignore recording HUD and webcam overlay clicks when generating auto-zooms #1200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,10 +11,73 @@ vi.mock("electron", () => ({ | |
| }, | ||
| })); | ||
|
|
||
| vi.mock("../../windows", () => ({ | ||
| getHudOverlayInteractiveBounds: vi.fn(), | ||
| getHudOverlayWindow: vi.fn(() => ({ | ||
| isVisible: () => true, | ||
| isMinimized: () => false, | ||
| })), | ||
| })); | ||
|
|
||
| vi.mock("../utils", () => ({ | ||
| getScreen: vi.fn(), | ||
| })); | ||
|
|
||
| vi.mock("./telemetry", () => ({ | ||
| getCursorCaptureElapsedMs: () => 42, | ||
| getNormalizedCursorPoint: () => ({ cx: 0.2, cy: 0.3 }), | ||
| isCursorCapturePaused: () => false, | ||
| pushCursorSample: vi.fn(), | ||
| })); | ||
|
|
||
| import { getHudOverlayInteractiveBounds } from "../../windows"; | ||
| import { setIsCursorCaptureActive, setLastLeftClick } from "../state"; | ||
| import { getScreen } from "../utils"; | ||
| import { | ||
| recordCursorMouseDown, | ||
| repairBundledUiohookBinaryForCurrentArch, | ||
| shouldStartGlobalInteractionHook, | ||
| } from "./interaction"; | ||
| import { pushCursorSample } from "./telemetry"; | ||
|
|
||
| describe("recordCursorMouseDown with recording overlays", () => { | ||
| afterEach(() => { | ||
| setIsCursorCaptureActive(false); | ||
| setLastLeftClick(null); | ||
| vi.clearAllMocks(); | ||
| }); | ||
|
|
||
| it("skips clicks on the HUD and webcam preview and records clicks outside both", () => { | ||
| setIsCursorCaptureActive(true); | ||
| setLastLeftClick(null); | ||
| vi.mocked(getHudOverlayInteractiveBounds).mockReturnValue([ | ||
| { left: 100, top: 100, right: 400, bottom: 150 }, | ||
| { left: 450, top: 200, right: 550, bottom: 300 }, | ||
| ]); | ||
|
Comment on lines
+53
to
+56
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| const getCursorScreenPoint = vi | ||
| .fn() | ||
| .mockReturnValueOnce({ x: 200, y: 125 }) | ||
| .mockReturnValueOnce({ x: 500, y: 250 }) | ||
| .mockReturnValueOnce({ x: 425, y: 180 }); | ||
| vi.mocked(getScreen).mockReturnValue({ getCursorScreenPoint } as ReturnType< | ||
| typeof getScreen | ||
| >); | ||
|
|
||
| recordCursorMouseDown(1); | ||
| recordCursorMouseDown(1); | ||
| expect(pushCursorSample).not.toHaveBeenCalled(); | ||
|
|
||
| recordCursorMouseDown(1); | ||
| expect(pushCursorSample).toHaveBeenCalledExactlyOnceWith( | ||
| 0.2, | ||
| 0.3, | ||
| 42, | ||
| "click", | ||
| undefined, | ||
| 1, | ||
| ); | ||
| }); | ||
| }); | ||
|
|
||
| describe("shouldStartGlobalInteractionHook", () => { | ||
| it("does not start the synchronous uiohook event tap on macOS", () => { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Script executed:
Repository: webadderallorg/Recordly
Length of output: 4734
Script executed:
Repository: webadderallorg/Recordly
Length of output: 11985
Test the HUD filter with non-null bounds.
Add
recordCursorMouseDowntests for clicks inside each rectangle and outside both rectangles. Also test hidden and minimized HUD windows. Assert which clicks are recorded.