Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEric Williams2018-01-11 13:40:58 -0500
committerEric Williams2018-01-17 11:05:23 -0500
commitbf4f51d091c1ca54883063f9567fd83cddafeb63 (patch)
tree66187284e35f133830ea90f959ec2fb91303253e /tests
parent247d7f9a4fdc740d6f8a82838c37cd93fd029b14 (diff)
downloadeclipse.platform.swt-bf4f51d091c1ca54883063f9567fd83cddafeb63.tar.gz
eclipse.platform.swt-bf4f51d091c1ca54883063f9567fd83cddafeb63.tar.xz
eclipse.platform.swt-bf4f51d091c1ca54883063f9567fd83cddafeb63.zip
Bug 528284: [GTK3] Toolbar: TCF dropdown control is cutoff
Still testing, DO NOT MERGE. PART 1/2: SWT fix (other fix is for TCF UI code) Use gtk_button_set_image() instead of gtk_container_add() to prevent smaller buttons from having trimmed arrow icons when SWT.ARROW is specified. This change in logic is due to GTK3 using an actual GtkImage for icons, where GTK2 uses GtkArrow which is its own widget. Tested with ControlExample and the TCF Target Explorer ToolBar contribution. No AllNonBrowser JUnit tests fail. Change-Id: I3c4c33acb689ac36c4567cc8d7bbb5b3ff4e4c19 Signed-off-by: Eric Williams <ericwill@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.swt.tests.gtk/Bug Snippets/org/eclipse/swt/tests/gtk/snippets/Bug528284_TCFToolBarIssue.java79
1 files changed, 79 insertions, 0 deletions
diff --git a/tests/org.eclipse.swt.tests.gtk/Bug Snippets/org/eclipse/swt/tests/gtk/snippets/Bug528284_TCFToolBarIssue.java b/tests/org.eclipse.swt.tests.gtk/Bug Snippets/org/eclipse/swt/tests/gtk/snippets/Bug528284_TCFToolBarIssue.java
new file mode 100644
index 0000000000..e2f6a6853b
--- /dev/null
+++ b/tests/org.eclipse.swt.tests.gtk/Bug Snippets/org/eclipse/swt/tests/gtk/snippets/Bug528284_TCFToolBarIssue.java
@@ -0,0 +1,79 @@
+package org.eclipse.swt.tests.gtk.snippets;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+
+/*
+ * Title: Bug 528284: [GTK3] Toolbar: TCF dropdown control is cutoff
+ * How to run: launch snippet and observe ToolBar inside the Shell
+ * Bug description: the Label and Button are cut off on the bottom
+ * Expected results: the Label and Button should be displayed as expected
+ * GTK Version(s): GTK3
+ */
+public class Bug528284_TCFToolBarIssue {
+ public static void main(String[] args) {
+ Display display = new Display();
+ Shell shell = new Shell(display);
+ ToolBar bar = new ToolBar (shell, SWT.HORIZONTAL);
+
+ Composite panel = new Composite(bar, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 1; layout.marginWidth = 1;
+ panel.setLayout(layout);
+
+
+ Composite labelPanel = new Composite(panel, SWT.BORDER);
+ labelPanel.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
+ GridData layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ labelPanel.setLayoutData(layoutData);
+ layout = new GridLayout(3, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.horizontalSpacing = 0;
+ labelPanel.setLayout(layout);
+
+ Label image = new Label(labelPanel, SWT.NONE);
+ layoutData = new GridData(SWT.LEAD, SWT.CENTER, false, true);
+ layoutData.horizontalIndent = 1;
+ layoutData.minimumWidth=20;
+ layoutData.widthHint=20;
+ image.setLayoutData(layoutData);
+
+ Label text = new Label(labelPanel, SWT.NONE);
+ layoutData = new GridData(SWT.FILL, SWT.CENTER, true, true);
+ layoutData.minimumWidth = 25;
+ text.setLayoutData(layoutData);
+
+ Button button = new Button(labelPanel, SWT.ARROW | SWT.DOWN | SWT.FLAT | SWT.NO_FOCUS);
+ layoutData = new GridData(SWT.TRAIL, SWT.CENTER, false, true);
+ layoutData.minimumWidth=20;
+ layoutData.widthHint = 20;
+ button.setLayoutData(layoutData);
+
+ text.setText("this is a test");
+
+
+ ToolItem item = new ToolItem(bar, SWT.SEPARATOR);
+ item.setControl(panel);
+ item.setWidth(panel.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
+
+ bar.pack();
+ shell.pack();
+ shell.open();
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) {
+ display.sleep();
+ }
+ }
+ display.dispose();
+
+ }
+} \ No newline at end of file

Back to the top