1414
1515import org .eclipse .wb .core .model .ObjectInfo ;
1616import org .eclipse .wb .internal .core .utils .ui .MenuIntersector ;
17+ import org .eclipse .wb .internal .swing .model .CoordinateUtils ;
1718import org .eclipse .wb .internal .swing .model .component .ComponentInfo ;
1819import org .eclipse .wb .internal .swing .model .component .ContainerInfo ;
1920import org .eclipse .wb .internal .swing .model .layout .FlowLayoutInfo ;
2223import org .eclipse .wb .internal .swing .model .util .surround .SwingSurroundSupport ;
2324import org .eclipse .wb .tests .designer .swing .SwingModelTest ;
2425
26+ import org .eclipse .draw2d .geometry .Insets ;
27+ import org .eclipse .draw2d .geometry .Rectangle ;
2528import org .eclipse .jface .action .IAction ;
2629import org .eclipse .jface .action .IMenuManager ;
2730import org .eclipse .jface .action .MenuManager ;
2831
29- import org .junit .jupiter .api .Disabled ;
3032import org .junit .jupiter .api .Test ;
3133
3234import java .util .ArrayList ;
3335import java .util .Collections ;
3436import java .util .List ;
3537
38+ import javax .swing .BorderFactory ;
3639import javax .swing .JButton ;
3740import javax .swing .JPanel ;
3841import javax .swing .JScrollPane ;
3942import javax .swing .JSplitPane ;
4043import javax .swing .JTabbedPane ;
4144import javax .swing .JTable ;
45+ import javax .swing .border .TitledBorder ;
4246
4347/**
4448 * Tests for {@link SwingSurroundSupport}.
@@ -316,7 +320,6 @@ public Test() {
316320 /**
317321 * Single {@link ComponentInfo} on {@link AbsoluteLayoutInfo}.
318322 */
319- @ Disabled
320323 @ Test
321324 public void test_absolute_singleControl_onTitledJPanel () throws Exception {
322325 ContainerInfo panel = parseContainer ("""
@@ -332,10 +335,15 @@ public Test() {
332335 }""" );
333336 panel .refresh ();
334337 ComponentInfo button = panel .getChildrenComponents ().get (0 );
338+
339+ TitledBorder border = BorderFactory .createTitledBorder ("JPanel title" );
340+ Insets insets = CoordinateUtils .get (border .getBorderInsets (button .getComponent ()));
341+
335342 // run action
336343 runSurround ("javax.swing.JPanel (border)" , button );
337- String expectedPanelBounds = "44, 28, 112, 79" ;
338- String expectedButtonBounds = "6, 22, 100, 50" ;
344+ Rectangle r = new Rectangle (50 , 50 , 100 , 50 ).expand (insets );
345+ String expectedPanelBounds = "%d, %d, %d, %d" .formatted (r .x , r .y , r .width , r .height );
346+ String expectedButtonBounds = "%d, %d, 100, 50" .formatted (insets .left , insets .top );
339347 assertEditor ("""
340348 public class Test extends JPanel {
341349 public Test() {
0 commit comments