| 76 | |
| 77 | |
| 78 | class FakeDesktop(BetaAbstractComputerToolset20260801): |
| 79 | def __init__(self, desktop: Desktop | None = None, **options: Any) -> None: |
| 80 | self.desktop = desktop or Desktop() |
| 81 | # the toolset serves `type`, `key` and `hold_key`, so it needs a `confirm`; a test that wants none passes `None` |
| 82 | # and turns `type`, `key` and `hold_key` off |
| 83 | options.setdefault("confirm", approve) |
| 84 | super().__init__(**options) |
| 85 | |
| 86 | @override |
| 87 | def screenshot(self, context: BetaToolsetCallContext, input: BetaComputerScreenshotInput) -> BetaScreenshotResult: |
| 88 | return self.desktop.screenshot(context, input) |
| 89 | |
| 90 | @override |
| 91 | def zoom(self, context: BetaToolsetCallContext, input: BetaComputerZoomInput) -> BetaScreenshotResult: |
| 92 | return self.desktop.zoom(context, input) |
| 93 | |
| 94 | @override |
| 95 | def cursor_position( |
| 96 | self, context: BetaToolsetCallContext, input: BetaComputerCursorPositionInput |
| 97 | ) -> BetaComputerCursorPositionResult: |
| 98 | return self.desktop.cursor_position(context, input) |
| 99 | |
| 100 | @override |
| 101 | def mouse_move(self, context: BetaToolsetCallContext, input: BetaComputerMouseMoveInput) -> str | None: |
| 102 | return self.desktop.mouse_move(context, input) |
| 103 | |
| 104 | @override |
| 105 | def left_click(self, context: BetaToolsetCallContext, input: BetaComputerLeftClickInput) -> str | None: |
| 106 | return self.desktop.action("left_click", context, input) |
| 107 | |
| 108 | @override |
| 109 | def left_click_drag(self, context: BetaToolsetCallContext, input: BetaComputerLeftClickDragInput) -> None: |
| 110 | self.desktop.action("left_click_drag", context, input) |
| 111 | |
| 112 | @override |
| 113 | def type(self, context: BetaToolsetCallContext, input: BetaComputerTypeInput) -> None: |
| 114 | self.desktop.action("type", context, input) |
| 115 | |
| 116 | @override |
| 117 | def key(self, context: BetaToolsetCallContext, input: BetaComputerKeyInput) -> None: |
| 118 | self.desktop.action("key", context, input) |
| 119 | |
| 120 | @override |
| 121 | def hold_key(self, context: BetaToolsetCallContext, input: BetaComputerHoldKeyInput) -> None: |
| 122 | self.desktop.action("hold_key", context, input) |
| 123 | |
| 124 | @override |
| 125 | def scroll(self, context: BetaToolsetCallContext, input: BetaComputerScrollInput) -> None: |
| 126 | self.desktop.action("scroll", context, input) |
| 127 | |
| 128 | @override |
| 129 | def wait(self, context: BetaToolsetCallContext, input: BetaComputerWaitInput) -> None: |
| 130 | self.desktop.action("wait", context, input) |
| 131 | |
| 132 | |
| 133 | class AsyncFakeDesktop(BetaAsyncAbstractComputerToolset20260801): |
no outgoing calls