feat(lib): switch __init__ to ONNX-backed generate/generate_scroll

This commit is contained in:
2026-05-12 01:16:03 +08:00
parent 4e69ecc963
commit d39db46170
5 changed files with 223 additions and 4 deletions

View File

@@ -35,3 +35,19 @@ def test_scroll_invalid_path() -> None:
from ai_mouse.scroll import ScrollModel
with pytest.raises(ModelLoadError):
ScrollModel(model_path="/no/such/path")
def test_scroll_model_timestamps_monotonic() -> None:
from ai_mouse.scroll import ScrollModel
m = ScrollModel()
events = m.generate(0, 2000, mode="target")
times = [e["t"] for e in events]
for i in range(1, len(times)):
assert times[i] >= times[i - 1]
def test_scroll_model_deltaY_are_integers() -> None:
from ai_mouse.scroll import ScrollModel
m = ScrollModel()
events = m.generate(0, 2000, mode="target")
assert all(isinstance(e["deltaY"], int) for e in events)