2727
2828import org .eclipse .draw2d .geometry .Insets ;
2929import org .eclipse .draw2d .geometry .Rectangle ;
30+ import org .eclipse .swt .SWT ;
31+ import org .eclipse .swt .layout .FillLayout ;
32+ import org .eclipse .swt .widgets .Shell ;
3033import org .eclipse .swt .widgets .TabItem ;
3134import org .eclipse .swt .widgets .Table ;
3235import org .eclipse .swt .widgets .TableColumn ;
3336import org .eclipse .swt .widgets .TableItem ;
3437
35- import org .junit .jupiter .api .Disabled ;
3638import org .junit .jupiter .api .Test ;
3739
3840import java .util .List ;
@@ -183,8 +185,6 @@ public Test() {
183185 * In SWT Cocoa and Linux GTK, the column headers are excluded from the client
184186 * area, hence why we have to adjust them for the tests.
185187 */
186- // Disabled because of https://github.com/eclipse-windowbuilder/windowbuilder/issues/389
187- @ Disabled
188188 @ Test
189189 public void test_TableColumn () throws Exception {
190190 CompositeInfo shell = parseComposite ("""
@@ -204,6 +204,45 @@ public Test() {
204204 }
205205 }""" );
206206 shell .refresh ();
207+ ((Shell ) shell .getWidget ()).open ();
208+ shell .getWidget ().setVisible (true );
209+ shell .getWidget ().setLocation (50 , 0 );
210+ waitEventLoop (5 );
211+ shell .getWidget ().setLocation (50 , 0 );
212+ waitEventLoop (5 );
213+ shell .getWidget ().setLocation (50 , 0 );
214+ waitEventLoop (5 );
215+ shell .getWidget ().setVisible (false );
216+ waitEventLoop (5 );
217+ System .out .println (shell .getWidget ().getBounds ());
218+ {
219+ Shell s = new Shell () {
220+ {
221+ setLayout (new FillLayout ());
222+ Table table = new Table (this , SWT .BORDER );
223+ table .setHeaderVisible (true );
224+ {
225+ TableColumn tableColumn_1 = new TableColumn (table , SWT .NONE );
226+ tableColumn_1 .setWidth (50 );
227+ }
228+ {
229+ TableColumn tableColumn_2 = new TableColumn (table , SWT .NONE );
230+ tableColumn_2 .setWidth (100 );
231+ }
232+ }
233+
234+ @ Override
235+ protected void checkSubclass () {
236+
237+ }
238+ };
239+ s .open ();
240+ Table t = (Table ) s .getChildren ()[0 ];
241+ TableColumn t0 = t .getColumn (0 );
242+ System .out .println ("<<<<" );
243+ System .out .println (t0 .getWidth ());
244+ s .dispose ();
245+ }
207246 TableInfo table = (TableInfo ) shell .getChildrenControls ().get (0 );
208247 // prepare columns
209248 List <TableColumnInfo > columns = table .getColumns ();
@@ -213,20 +252,24 @@ public Test() {
213252 // check bounds
214253 Insets tableInsets = table .getClientAreaInsets ();
215254 {
255+ int headerHeight = table .getWidget ().getHeaderHeight ();
216256 // "model" bounds
217257 Rectangle modelBounds = column_1 .getModelBounds ();
258+ System .out .println ("###############################" );
259+ System .out .println (column_1 .getWidget ().getWidth ());
260+ System .out .println (column_1 .getModelBounds ());
218261 if (!EnvironmentUtils .IS_WINDOWS ) {
219- modelBounds .y += table . getWidget (). getHeaderHeight () ;
262+ modelBounds .y += headerHeight ;
220263 }
221264 assertNotNull (modelBounds );
222265 assertEquals (0 , modelBounds .x );
223266 assertEquals (0 , modelBounds .y );
224267 assertEquals (50 , modelBounds .width );
225- assertTrue ( modelBounds . height > 15 && modelBounds .height < 50 );
268+ assertEquals ( headerHeight , modelBounds .height );
226269 // "shot" bounds
227270 Rectangle bounds = column_1 .getBounds ();
228271 if (!EnvironmentUtils .IS_WINDOWS ) {
229- bounds .y += table . getWidget (). getHeaderHeight () ;
272+ bounds .y += headerHeight ;
230273 }
231274 assertEquals (tableInsets .left , bounds .x );
232275 assertEquals (tableInsets .top , bounds .y );
0 commit comments