# -*- coding: utf-8 -*- """354-3 종단 그래프 스크롤 끊김 — 동기화 메아리 · 스크롤마다 유토 다시 셈. - 메아리: scroll 은 다음 틀에 옴 → 동기 플래그로 못 막아 한 틀 전 값을 되씀 → 뒤로 튐 → 휠 이동이 접힘. 공용 `linkScrollLeft`(Wheel.ts)가 써 넣은 값으로 온 scroll 을 무시. 가짜 창(다음 틀 scroll) 재현 — 옛 잇기는 뒤로 튐 · 멈춤, 새 잇기는 4 경우 × 휠 쪽 둘 모두 튐 0. - 유토곡선 = 늘 전체 맞춤 · 종단과 안 이음(367-1) — 휠 · 잇기 경우는 공용 도우미 시험으로 남김. `helper_354_3_scroll_echo.cjs` 가 진짜 휠 · 잇기 TS 를 가짜 창 위에서 돌림. """ import json import os import subprocess from pathlib import Path import pytest HERE = os.path.dirname(os.path.abspath(__file__)) B05 = Path(HERE).parents[1] / "B05_Profile" CASES = [ f"{driver}|table={table}|balance={balance}" for driver in ("body", "mass") for table in ("true", "false") for balance in ("false", "true") ] @pytest.fixture(scope="module") def r(): proc = subprocess.run( ["node", os.path.join(HERE, "helper_354_3_scroll_echo.cjs")], capture_output=True, text=True, encoding="utf-8", timeout=60, ) assert proc.returncode == 0, proc.stderr return json.loads(proc.stdout) def test_옛_잇기는_메아리로_뒤로_튐(r): # 표 · 분배 끔(사용자 보고 경우)에서 휠 다섯 칸(1,200px) 중 210px 에서 멈춤 assert r["old|body|table=false|balance=false"]["back"] > 0 assert r["old|body|table=false|balance=false"]["end"] < 1200 # 분배 켜고 표 끔 = 잇기 없음 — 사용자 관찰(분배 켜면 매끄러움)과 같음 assert r["old|body|table=false|balance=true"] == { "back": 0, "end": 1200, "lead": 1200, "mass": 0, "table": 0, } @pytest.mark.parametrize("case", CASES) def test_새_잇기는_뒤로_튐_0_끝까지(r, case): got = r[f"new|{case}"] assert got["back"] == 0 assert got["end"] == 1200 and got["lead"] == 1200 table, balance = "table=true" in case, "balance=true" in case assert got["table"] == (1200 if table else 0) assert got["mass"] == (0 if balance else 1200) def test_표만_잇기_유토는_안_이음(): # 367-1 유토곡선 = 늘 전체 맞춤 · 종단 스크롤과 안 이음 table = (B05 / "B05_Profile_UI_Profile_TableOverlay.ts").read_text(encoding="utf-8") assert "linkScrollLeft(main, scroll" in table assert "syncing" not in table mass = (B05 / "B05_Profile_UI_Profile_MassHaul.ts").read_text(encoding="utf-8") for gone in ("linkScrollLeft", "attachWheelHorizontalScroll", "attachScrollSync", "drawWindow"): assert gone not in mass, gone def test_유토는_늘_전체_맞춤_스크롤마다_안_그림(): mass = (B05 / "B05_Profile_UI_Profile_MassHaul.ts").read_text(encoding="utf-8") assert "hideStations: true," in mass assert "viewRange: undefined," in mass assert "scroll.scrollLeft = 0;" in mass assert "createMassHaulWindowState" not in mass and "scheduleMassHaulSettle" not in mass assert "if (series !== lastSeries) emitSummary(series);" in mass render = (B05 / "B05_Profile_UI_Profile_Render.ts").read_text(encoding="utf-8") assert "drawWindow" not in render and "massHaulUpdater" not in render css = (B05 / "B05_Profile_UI_Style_MassHaul.css").read_text(encoding="utf-8") block = css[css.index(".b05-profile__masshaul-scroll {") :] assert "overflow-x: hidden;" in block[: block.index("}")]