@@ -80,6 +80,50 @@ def test_shape_builder_returns_drawio_cell_without_undefined_header():
8080 assert shape ["props" ] == {"owner" : "test" }
8181
8282
83+ def test_shape_builder_preserves_long_labels_without_truncation ():
84+ """Long shape labels are preserved instead of shortened with ellipses."""
85+ types = Types (Common ())
86+ long_label = "My Production VPC with a long name"
87+ node = {
88+ "shape" : "gploc" ,
89+ "label" : long_label ,
90+ "sublabel" : "" ,
91+ "genname" : "VPC" ,
92+ "linecolor" : Colors .lines ["network" ],
93+ "fillcolor" : Colors .fills ["network" ],
94+ "parentid" : None ,
95+ "image" : "" ,
96+ "icon" : "" ,
97+ }
98+
99+ shape = types .buildShape ("shape-long-label" , node , 10 , 20 , 200 , 120 , {}, False )
100+
101+ assert long_label in shape ["cell" ]["value" ]
102+ assert "..." not in shape ["cell" ]["value" ]
103+
104+
105+ def test_python_api_preserves_long_group_labels_in_drawio_output (tmp_path : Path ):
106+ """Diagram-as-code output keeps full group labels in the generated DrawIO file."""
107+ from ibmdiagrams .ibmcloud .compute import VirtualServer
108+ from ibmdiagrams .ibmcloud .diagram import Diagram
109+ from ibmdiagrams .ibmcloud .groups import VPC , IBMCloud , Region , Subnet , Zone
110+
111+ with Diagram ("long-labels" , output = str (tmp_path )):
112+ with IBMCloud ("IBM Cloud with a long name" ):
113+ with Region ("Dallas" ):
114+ with VPC ("My Production VPC with a long name" ):
115+ with Zone ("Zone 1" , "10.10.0.0/18" ):
116+ with Subnet ("App Subnet" , "10.10.10.0/24" ):
117+ VirtualServer ("Web Server" , "10.10.10.4" )
118+
119+ drawio = (tmp_path / "long-labels.drawio" ).read_text ()
120+
121+ assert "IBM Cloud with a long name" in drawio
122+ assert "My Production VPC with a long name" in drawio
123+ assert "IBM Cloud with..." not in drawio
124+ assert "My Production ..." not in drawio
125+
126+
83127def test_value_builder_uses_text_style_without_undefined_shape_map ():
84128 """Value builder uses the built-in text style instead of an undefined shape map."""
85129 types = Types (Common ())
0 commit comments