From 4f41976292c1de9f6726702369aac30da7b0fbc8 Mon Sep 17 00:00:00 2001 From: Armor00 <2654988228@qq.com> Date: Thu, 9 Jul 2026 17:33:57 +0800 Subject: [PATCH] style: label Guanghan radiator panels Co-Authored-By: Codex --- data/wiki/guanghan_topology_demo.html | 5 +++++ tests/test_guanghan_topology_demo.py | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/data/wiki/guanghan_topology_demo.html b/data/wiki/guanghan_topology_demo.html index de9a32b..da0d4d5 100644 --- a/data/wiki/guanghan_topology_demo.html +++ b/data/wiki/guanghan_topology_demo.html @@ -145,6 +145,7 @@ .radiator { pointer-events: none; } .radiator rect { fill: #6b5814; stroke: var(--radiator); stroke-width: 2; vector-effect: non-scaling-stroke; } .radiator line { stroke: #f8e798; stroke-width: 1.5; vector-effect: non-scaling-stroke; } + .radiator-label { fill: #f4df7b; font-size: 15px; font-weight: 650; text-anchor: middle; } .click-note { margin: 13px 0 0; @@ -339,18 +340,22 @@ + 散热器 + 散热器 + 散热器 + 散热器 diff --git a/tests/test_guanghan_topology_demo.py b/tests/test_guanghan_topology_demo.py index 27ac135..6c57692 100644 --- a/tests/test_guanghan_topology_demo.py +++ b/tests/test_guanghan_topology_demo.py @@ -54,6 +54,25 @@ class GuanghanTopologySourceTests(unittest.TestCase): r'<(?:g|rect)[^>]+class="[^"]*radiator[^"]*"[^>]+data-module=', ) + def test_each_radiator_has_a_visible_text_label(self) -> None: + radiator_groups = re.findall( + r']*>(.*?)', + self.html, + flags=re.S, + ) + self.assertEqual(len(radiator_groups), 4) + for group in radiator_groups: + self.assertIn(">散热器", group) + rect = re.search(r']+x="(\d+)" y="(\d+)"[^>]*>散热器', group) + self.assertIsNotNone(rect) + self.assertIsNotNone(label) + rect_x, rect_y, rect_width = map(int, rect.groups()) + label_x, label_y = map(int, label.groups()) + self.assertGreaterEqual(label_x, rect_x) + self.assertLessEqual(label_x, rect_x + rect_width) + self.assertLess(label_y, rect_y) + def test_future_extensions_exist_only_as_source_comments(self) -> None: comments = "\n".join(re.findall(r"", self.html, flags=re.S)) visible_source = re.sub(r"", "", self.html, flags=re.S)