"""634-2 표 두 장(요구 546) — 그룹1 22 겹 호버제목 · 묶음 · 그룹2 17 줄 호버제목 · 페이지 덮어쓰기 없음 · 계류 · 도로 띠 둘.""" import re from pathlib import Path ROOT = Path(__file__).resolve().parents[2] MAP = ROOT / "A00_Common" / "map" def _read(path: Path) -> str: return path.read_text(encoding="utf-8") # 요구 546 그룹1 표(호버제목 · 아이콘 그룹명) + 도로300m(표 밖 · 「도로」 묶음) GROUP1 = [ ("satellite", "위성사진", None), ("hillshade", "음영기복도", None), ("contour", "등고선", None), ("slope", "급경사", None), ("stream", "세류", "water"), ("water", "하천", "water"), ("zeroOrder", "0차곡", "water"), ("bands", "계류100m", "water"), ("road", "도로", "road"), ("nationalRoad", "임도망도", "road"), ("forestRoadFile", "임도(업로드)", "road"), ("roadBands", "도로300m", "road"), ("cadastral", "지적도", "land"), ("building", "건물", "land"), ("place", "지명", "land"), ("zones", "보호규제구역", "limit"), ("soils", "산림입지도", "limit"), ("ecoForest", "국유림·사유림", "limit"), ("ecology", "생태자연도", "limit"), ("landslide", "산사태위험지도", "limit"), ("landslideZones", "산사태취약지역", "limit"), ("faults", "단층", "limit"), ("lineaments", "지질구조선", "limit"), ] GROUP2 = [ ("hint-toggle", "도움말"), ("undo", "되돌리기"), ("redo", "다시하기"), ("view3d", "3D"), ("rotate-ccw", "좌 회전"), ("rotate-cw", "우 회전"), ("contour-minor", "등고선 1m"), ("stations", "측점"), ("slopes", "길이·기울기"), ("footprint", "절성토선"), ("measure", "길이측정"), ("station-snap", "스냅"), ("snap-step", "스냅 간격"), ("expected-draw", "예정노선 변경"), ("expected-original", "예정노선 원본"), ("recommend", "추천노선"), ("terrain", "수치지형도/라이다"), ] def test_그룹1_표_차례_호버_묶음(): src = _read(MAP / "map_layer_list.ts") rows = re.findall(r'row\("(\w+)", "\w+", "([^"]+)", (?:"(\w+)"|null)', src) assert [(k, t, g or None) for k, t, g in rows] == GROUP1 for name in ("수계망도", "도로", "토지·건물", "제한·재해"): assert f'name: "{name}"' in src # 표 「사용」 = 두 페이지 모두 · 숨김 표 없음 assert "pages: BOTH" in src and "hide" not in src[src.index("MAP_LAYER_PAGES") :] def test_그룹2_표_호버(): src = _read(MAP / "map_toolbar.ts") rows = re.findall(r'key: "([\w-]+)",\s+title: "([^"]+)"', src) assert rows == GROUP2 tools = _read(ROOT / "ui_template" / "ui_template_map_tools.ts") for key, title in GROUP2[1:-4]: if key != "snap-step": assert re.search(rf'"?{key}"?: \{{ icon: "\w+", title: "{title}"', tools), key def test_페이지_호버_덮어쓰기_없음(): files = [ ROOT / "B05_Profile" / "B05_Profile_UI_RouteEdit_Chrome.ts", ROOT / "D03_PlanAnalysis" / "D03_PlanAnalysis_UI_Map.ts", ROOT / "A00_Common" / "design" / "design_view_profile_3d_modal.ts", ] for path in files: for call in re.findall(r"mapToolButton\([^)]*\)", _read(path), re.S): assert "title" not in call, (path.name, call) layers = _read(ROOT / "B05_Profile" / "B05_Profile_UI_RouteEdit_Layers.ts") assert ( "layerBar.root.querySelector" not in layers and "layerBar.sync({ ready: !!meta, glOn, why })" in layers ) assert 'forestRoadFile: "받은 임도 자료 없음"' in layers # B05 임도(업로드) 막힘 + 까닭 edit = _read(ROOT / "B05_Profile" / "B05_Profile_UI_RouteEdit.ts") assert 'mapToolTip(minorContourButton, contours?.minor ? null : "LAS 등고선 없음")' in edit bar = _read(MAP / "map_layer_bar.ts") assert 'const GL_TITLE = "그래픽 카드";' in bar and "multi: true" in bar def test_계류_도로_띠_둘(): specs = _read(MAP / "map_layer_specs.ts") assert 'fillEdge("roadBands", "bands"' in specs and 'fillEdge("bands", "bands"' in specs assert specs.index('fillEdge("roadBands"') < specs.index('fillEdge("bands", "bands"') # 옛 차례 legend = _read(MAP / "map_legend.ts") assert "...(on.bands" in legend and "...(on.roadBands" in legend paint = _read(ROOT / "D03_PlanAnalysis" / "D03_PlanAnalysis_UI_LayerPaint.ts") assert "if (on.roadBands)" in paint and "if (on.bands)" in paint b05 = _read(ROOT / "B05_Profile" / "B05_Profile_UI_RouteEdit_Layers.ts") assert 'key === "bands" || key === "roadBands"' in b05 and "fetchPlanBands(projectId)" in b05