Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
adamws committed Nov 25, 2024
1 parent 42d25dd commit 4382cea
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion tests/dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ pytest-metadata==3.1.1
pytest-html==4.1.1
pytest-xdist==3.6.1
PyVirtualDisplay==3.0
keyboard==0.13.5
ahk==1.8.0
23 changes: 13 additions & 10 deletions tests/src/test_rendering.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
from contextlib import contextmanager
from pathlib import Path

import keyboard
import pytest
from pyvirtualdisplay.smartdisplay import SmartDisplay

if sys.platform == "win32":
from ahk import AHK

logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -157,17 +159,18 @@ def run_process_capture_logs(command, cwd, name="", process_holder=None) -> None

def run_typing_process(workdir, text: str) -> None:
if sys.platform == "win32":
#with open(workdir / "type.ahk", "w", encoding="utf-8") as f:
# f.write("SetKeyDelay 400, 100\n") # 400ms between keys, 100ms between down/up.
# f.write(f"SendEvent \"{text}\"\n")
# f.write("exit")
#result = subprocess.run(["AutoHotkey.exe", "/ErrorStdOut", "type.ahk"], cwd=workdir)
keyboard.write(text, delay=0.4)
# with open(workdir / "type.ahk", "w", encoding="utf-8") as f:
# f.write("SetKeyDelay 400, 100\n") # 400ms between keys, 100ms between down/up.
# f.write(f"SendEvent \"{text}\"\n")
# f.write("exit")
# result = subprocess.run(["AutoHotkey.exe", "/ErrorStdOut", "type.ahk"], cwd=workdir)
ahk = AHK()
ahk.type(text);
else:
result = subprocess.run(["xdotool", "type", "--delay", "400", text])
logger.info(f"stdout: {result.stdout}")
logger.info(f"stderr: {result.stderr}")
assert result.returncode == 0
#logger.info(f"stdout: {result.stdout}")
#logger.info(f"stderr: {result.stderr}")
#assert result.returncode == 0


def __get_parameters():
Expand Down

0 comments on commit 4382cea

Please sign in to comment.