34 lines
1018 B
Python
34 lines
1018 B
Python
# -*- coding: utf-8 -*-
|
||||
|
|
"""海绵钛驾驶舱布局冒烟脚本(Issue #55)。
|
|||
|
|
|
|||
|
|
直接运行 ``python _sanity_check.py`` 验证:cockpit.ti.yaml + point_dict.default.csv
|
|||
|
|
端到端校验通过(widget 类型/网格/bind/四状态全覆盖)。零第三方依赖。
|
|||
|
|
"""
|
|||
|
|
import os
|
|||
|
|
import sys
|
|||
|
|
|
|||
|
|
HERE = os.path.dirname(os.path.abspath(__file__))
|
|||
|
|
sys.path.insert(0, HERE)
|
|||
|
|
|
|||
|
|
from layout_validator import LayoutValidator # noqa: E402
|
|||
|
|
|
|||
|
|
LAYOUT_YAML = os.path.join(HERE, "cockpit.ti.yaml")
|
|||
|
|
POINT_DICT_CSV = os.path.join(
|
|||
|
|
HERE, os.pardir, "point-dict", "point_dict.default.csv")
|
|||
|
|
|
|||
|
|
|
|||
|
|
def main() -> int:
|
|||
|
|
report = LayoutValidator(LAYOUT_YAML, POINT_DICT_CSV).validate()
|
|||
|
|
if not report.passed:
|
|||
|
|
print("FAIL")
|
|||
|
|
for issue in report.errors:
|
|||
|
|
print(f" - [{issue.widget_id}] {issue.field}: {issue.reason}")
|
|||
|
|
return 1
|
|||
|
|
print(f"OK: {report.widget_count} widgets,"
|
|||
|
|
f"类型/网格/bind/四状态校验通过")
|
|||
|
|
return 0
|
|||
|
|
|
|||
|
|
|
|||
|
|
if __name__ == "__main__":
|
|||
|
|
raise SystemExit(main())
|