@@ -236,4 +236,59 @@ public void SnapLine_ToString(string filter, string expected)
236236
237237 Assert . Equal ( expected , snapLine . ToString ( ) ) ;
238238 }
239+
240+ // Unit test for https://github.com/dotnet/winforms/issues/13305
241+ [ Fact ]
242+ public void SnapLine_ReturnOverrided ( )
243+ {
244+ using ControlDesigner baseDesigner = new ( ) ;
245+ using Control control = new ( ) ;
246+ baseDesigner . Initialize ( control ) ;
247+ baseDesigner . SnapLines . Count . Should ( ) . Be ( 8 ) ;
248+
249+ ControlDesigner derivedDesigner = new ButtonBaseDesigner ( ) ;
250+ using Button button = new ( ) ;
251+ derivedDesigner . Initialize ( button ) ;
252+ derivedDesigner . SnapLines . Count . Should ( ) . Be ( 9 ) ;
253+
254+ derivedDesigner = new ComboBoxDesigner ( ) ;
255+ using ComboBox comboBox = new ( ) ;
256+ derivedDesigner . Initialize ( comboBox ) ;
257+ derivedDesigner . SnapLines . Count . Should ( ) . Be ( 9 ) ;
258+
259+ derivedDesigner = new DateTimePickerDesigner ( ) ;
260+ using DateTimePicker dateTimePicker = new ( ) ;
261+ derivedDesigner . Initialize ( dateTimePicker ) ;
262+ derivedDesigner . SnapLines . Count . Should ( ) . Be ( 9 ) ;
263+
264+ derivedDesigner = new LabelDesigner ( ) ;
265+ using Label label = new ( ) ;
266+ derivedDesigner . Initialize ( label ) ;
267+ derivedDesigner . SnapLines . Count . Should ( ) . Be ( 9 ) ;
268+
269+ derivedDesigner = new ParentControlDesigner ( ) ;
270+ derivedDesigner . Initialize ( control ) ;
271+ derivedDesigner . SnapLines . Count . Should ( ) . Be ( 12 ) ;
272+
273+ derivedDesigner = new SplitterPanelDesigner ( ) ;
274+ using SplitContainer splitContainer = new ( ) ;
275+ using SplitterPanel splitterPanel = new ( splitContainer ) ;
276+ derivedDesigner . Initialize ( splitterPanel ) ;
277+ derivedDesigner . SnapLines . Count . Should ( ) . Be ( 4 ) ;
278+
279+ derivedDesigner = new TextBoxBaseDesigner ( ) ;
280+ using TextBox textBox = new ( ) ;
281+ derivedDesigner . Initialize ( textBox ) ;
282+ derivedDesigner . SnapLines . Count . Should ( ) . Be ( 9 ) ;
283+
284+ derivedDesigner = new ToolStripContentPanelDesigner ( ) ;
285+ using ToolStripContentPanel toolStripContentPanel = new ( ) ;
286+ derivedDesigner . Initialize ( toolStripContentPanel ) ;
287+ derivedDesigner . SnapLines . Count . Should ( ) . Be ( 4 ) ;
288+
289+ derivedDesigner = new UpDownBaseDesigner ( ) ;
290+ using DomainUpDown domainUpDown = new ( ) ;
291+ derivedDesigner . Initialize ( domainUpDown ) ;
292+ derivedDesigner . SnapLines . Count . Should ( ) . Be ( 9 ) ;
293+ }
239294}
0 commit comments