Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 6cfa5d0bdf22fc9f5822bc67903a215fd77e506d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package org.eclipse.swt.tests.gtk.snippets;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;

/*
 * Title: Bug 465280 - [GTK3] OS.gtk_widget_get_allocation returns (0,0) for invisible controls
 * How to run: launch snippet and observe coordinates printed in console
 * Bug description: The coordinates are (0,0)
 * Expected results: The coordinates should not be (0,0) if the widget is hidden.
 * GTK Version(s): GTK3.8+
 */
public class Bug465280_InvisibleControlAllocation {
	public static void main(String[] args) {
        String property = System.getenv("SWT_GTK3");
        if (property != null) {
        	System.err.println("GTK"+(property.equals("1")?"3":"2"));
        }
        Display display = new Display ();
        Shell shell = new Shell(display);
        shell.setLayout(new FillLayout());
        Label descriptionHint = new Label(shell, SWT.WRAP);
        descriptionHint.setText("This is a very very very very very very long string");
        descriptionHint.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
        descriptionHint.setVisible(false);
        shell.open();
        System.err.println(descriptionHint.getSize());
        while (!shell.isDisposed ()) {
                if (!display.readAndDispatch ()) display.sleep ();
        }
        display.dispose ();
}

}

Back to the top