| 1 | """실제 X11 창에서 파일 행을 눌렀을 때 선택 배경이 바뀌는지 확인함.""" |
| 2 | |
| 3 | import argparse |
| 4 | from pathlib import Path |
| 5 | import subprocess |
| 6 | import sys |
| 7 | import time |
| 8 | |
| 9 | import capture |
| 10 | |
| 11 | |
| 12 | def main(): |
| 13 | parser = argparse.ArgumentParser(description=__doc__) |
| 14 | parser.add_argument("--binary", type=Path, required=True) |
| 15 | args = parser.parse_args() |
| 16 | original = capture.command |
| 17 | clicked = False |
| 18 | |
| 19 | def command(arguments, environment, **kwargs): |
| 20 | nonlocal clicked |
| 21 | if arguments[:3] == ["xdotool", "mousemove", "--window"] and arguments[-2:] == ["2", "2"]: |
| 22 | original( |
| 23 | ["xdotool", "mousemove", "--window", arguments[3], "120", "271"], |
| 24 | environment, |
| 25 | ) |
| 26 | time.sleep(0.2) |
| 27 | original(["xdotool", "click", "1"], environment) |
| 28 | clicked = True |
| 29 | time.sleep(0.2) |
| 30 | return original(arguments, environment, **kwargs) |
| 31 | |
| 32 | capture.command = command |
| 33 | output = capture.ROOT / "tests/ui-redesign/runs/row-selection" |
| 34 | sys.argv = [ |
| 35 | sys.argv[0], "--binary", str(args.binary), "--variant", "after", |
| 36 | "--states", "opened", "--output", str(output), |
| 37 | ] |
| 38 | capture.main() |
| 39 | if not clicked: |
| 40 | raise AssertionError("행 클릭을 실행하지 못함") |
| 41 | pixel = subprocess.check_output( |
| 42 | ["convert", str(output / "opened.png"), "-format", "%[pixel:p{500,271}]", "info:"], |
| 43 | text=True, |
| 44 | ).strip() |
| 45 | if pixel != "srgb(232,240,254)": |
| 46 | raise AssertionError(f"행 선택 배경 불일치: {pixel}") |
| 47 | print("실제 파일 이름 클릭 후 선택 표시 확인") |
| 48 | |
| 49 | |
| 50 | if __name__ == "__main__": |
| 51 | main() |