@@ -143,6 +143,55 @@ describe('skipArgumentReporters_ — XML round-trip', () => {
143143 } )
144144} )
145145
146+ // ---------------------------------------------------------------------------
147+ // Procedure call block mutation round-trip (generateshadows tolerance)
148+ // ---------------------------------------------------------------------------
149+
150+ describe ( 'procedure call mutation round-trip' , ( ) => {
151+ it ( 'deserializing a call block without generateshadows does not throw' , ( ) => {
152+ // When dragging a procedure call from the flyout, Blockly serializes the
153+ // block (via callerMutationToDom, which omits generateshadows) then
154+ // deserializes the copy (via callerDomToMutation). Previously
155+ // callerDomToMutation required generateshadows, causing a crash.
156+ expect ( ( ) =>
157+ loadXml ( `
158+ <xml>
159+ <block type="procedures_definition">
160+ <statement name="custom_block">
161+ <block type="procedures_prototype">
162+ <mutation
163+ proccode="test %s"
164+ argumentids='["arg1"]'
165+ argumentnames='["x"]'
166+ argumentdefaults='[""]'
167+ warp="false">
168+ </mutation>
169+ <value name="arg1">
170+ <block type="argument_reporter_string_number">
171+ <field name="VALUE">x</field>
172+ </block>
173+ </value>
174+ </block>
175+ </statement>
176+ </block>
177+ <block type="procedures_call">
178+ <mutation
179+ proccode="test %s"
180+ argumentids='["arg1"]'
181+ warp="false">
182+ </mutation>
183+ </block>
184+ </xml>
185+ ` )
186+ ) . not . toThrow ( )
187+
188+ const callBlock = workspace . getAllBlocks ( false ) . find ( ( b ) => b . type === 'procedures_call' )
189+ assert ( callBlock , 'Expected procedures_call block' )
190+ // Without the generateshadows attribute, it should default to false.
191+ expect ( ( callBlock as any ) . generateShadows_ ) . toBe ( false )
192+ } )
193+ } )
194+
146195// ---------------------------------------------------------------------------
147196// PR #3492: context menu delegation
148197// ---------------------------------------------------------------------------
0 commit comments