feat(topology): add square light canvas
Co-Authored-By: OpenAI Codex <codex@openai.com>
This commit is contained in:
@@ -49,6 +49,13 @@ class GuanghanTopologySourceTests(unittest.TestCase):
|
||||
self.assertIn("decorationStyles", self.html)
|
||||
self.assertIn("legendItems", self.html)
|
||||
|
||||
def test_canvas_is_square_and_page_defaults_to_light(self) -> None:
|
||||
self.assertIn('viewBox="0 0 1900 1900"', self.html)
|
||||
self.assertIn("payload.layout.canvasWidth", self.html)
|
||||
self.assertIn("payload.layout.canvasHeight", self.html)
|
||||
self.assertIn("color-scheme: light", self.html)
|
||||
self.assertNotIn("color-scheme: dark", self.html)
|
||||
|
||||
def test_business_visual_semantics_are_not_css_hardcoded(self) -> None:
|
||||
forbidden = [
|
||||
".connection.structural",
|
||||
|
||||
@@ -211,8 +211,10 @@ class TopologyApiQueryTests(unittest.TestCase):
|
||||
|
||||
self.assertEqual(
|
||||
presentation["theme"]["key"],
|
||||
"guanghan_dark_engineering_v1",
|
||||
"guanghan_light_engineering_v1",
|
||||
)
|
||||
self.assertEqual(layout["layout"]["canvasWidth"], 1900.0)
|
||||
self.assertEqual(layout["layout"]["canvasHeight"], 1900.0)
|
||||
self.assertIn("nodeStyles", presentation)
|
||||
self.assertIn("edgeStyles", presentation)
|
||||
self.assertIn("decorationStyles", presentation)
|
||||
@@ -239,7 +241,7 @@ class TopologyApiQueryTests(unittest.TestCase):
|
||||
presentation["edgeStyles"]["pressurized_passage"],
|
||||
{
|
||||
"displayName": "加压走道",
|
||||
"strokeColor": "#51e89c",
|
||||
"strokeColor": "#168a55",
|
||||
"strokeWidth": 9.0,
|
||||
"dashArray": None,
|
||||
"lineCap": "square",
|
||||
@@ -265,15 +267,20 @@ class TopologyApiQueryTests(unittest.TestCase):
|
||||
conn.execute("SET search_path TO topology, public")
|
||||
with conn.cursor() as cur:
|
||||
cur.execute("""
|
||||
SELECT stroke_color
|
||||
FROM diagram_edge_styles
|
||||
WHERE connection_type = 'pressurized_passage'
|
||||
SELECT edge.stroke_color
|
||||
FROM diagram_edge_styles AS edge
|
||||
JOIN diagram_themes AS theme ON theme.id = edge.theme_id
|
||||
WHERE edge.connection_type = 'pressurized_passage'
|
||||
AND theme.theme_key = 'guanghan_light_engineering_v1'
|
||||
""")
|
||||
original_color = cur.fetchone()["stroke_color"]
|
||||
cur.execute("""
|
||||
UPDATE diagram_edge_styles
|
||||
UPDATE diagram_edge_styles AS edge
|
||||
SET stroke_color = '#00ffaa'
|
||||
WHERE connection_type = 'pressurized_passage'
|
||||
FROM diagram_themes AS theme
|
||||
WHERE theme.id = edge.theme_id
|
||||
AND edge.connection_type = 'pressurized_passage'
|
||||
AND theme.theme_key = 'guanghan_light_engineering_v1'
|
||||
""")
|
||||
conn.commit()
|
||||
try:
|
||||
@@ -290,9 +297,12 @@ class TopologyApiQueryTests(unittest.TestCase):
|
||||
finally:
|
||||
with conn.cursor() as cur:
|
||||
cur.execute("""
|
||||
UPDATE diagram_edge_styles
|
||||
UPDATE diagram_edge_styles AS edge
|
||||
SET stroke_color = %(original)s
|
||||
WHERE connection_type = 'pressurized_passage'
|
||||
FROM diagram_themes AS theme
|
||||
WHERE theme.id = edge.theme_id
|
||||
AND edge.connection_type = 'pressurized_passage'
|
||||
AND theme.theme_key = 'guanghan_light_engineering_v1'
|
||||
""", {"original": original_color})
|
||||
conn.commit()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user