Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEric Williams2018-09-25 20:26:55 +0000
committerEric Williams2018-09-26 15:46:55 +0000
commita6c0cf50c92fd9f414bf887e95bd587efc6b63e6 (patch)
treebb226c018e9685b3ebec5b146f379d05a52f902d /tests
parentdc50dc6c891a71ee517239f80d2738cecbffc48c (diff)
downloadeclipse.platform.swt-a6c0cf50c92fd9f414bf887e95bd587efc6b63e6.tar.gz
eclipse.platform.swt-a6c0cf50c92fd9f414bf887e95bd587efc6b63e6.tar.xz
eclipse.platform.swt-a6c0cf50c92fd9f414bf887e95bd587efc6b63e6.zip
Bug 539367: [GTK3] Long text in Combo drawn over drop-down button and
outside of combo Combos have a GtkCellView, which renders the text, and other icons. by default, GtkCellView has a "fit-model" property which is set to true. This means the content in the cell view will always expand to the maximum size. Setting it to false allows us to resize the cell view as desired. The fix for this bug is to set the clipping of the cell view to a smaller size: we find the x position of the drop down icon, minus its width. This stops the text from being drawn over the drop down icon, and sometimes over other widgets. Tested on GTK3.22 and 3.20, all other versions of GTK3 are unaffected. The snippets in this patch do not show the bug, nor does the one for bug 500703. Additionally, the keys preferences page does not exhibit any issues either. No AllNonBrowser JUnit tests fail. Change-Id: Iabfae03c7ee5b0279b87fa7054bc28c75d2d3b7e Signed-off-by: Eric Williams <ericwill@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug539367_ComboLongText.java53
-rw-r--r--tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug539367_ComboLongText2.java57
2 files changed, 110 insertions, 0 deletions
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug539367_ComboLongText.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug539367_ComboLongText.java
new file mode 100644
index 0000000000..eb4b44fe41
--- /dev/null
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug539367_ComboLongText.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Simeon Andreev and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Simeon Andreev - initial API and implementation
+ *******************************************************************************/
+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.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+public class Bug539367_ComboLongText {
+
+ public static void main(String[] args) {
+ Display display = new Display();
+ Shell shell = new Shell(display);
+ shell.setSize(400, 150);
+ shell.setText("Bug combo text");
+ shell.setLayout(new FillLayout());
+
+ Composite parent = new Composite(shell, SWT.BORDER);
+ parent.setLayout(new GridLayout());
+
+ Combo combo = new Combo(parent, SWT.READ_ONLY | SWT.DROP_DOWN);
+ GridData comboGridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
+ combo.setLayoutData(comboGridData);
+ combo.add("some long long long long combo text");
+ combo.select(0);
+
+ new Composite(shell, SWT.BORDER);
+
+ shell.open();
+
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch())
+ display.sleep();
+ }
+ display.dispose();
+ }
+} \ No newline at end of file
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug539367_ComboLongText2.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug539367_ComboLongText2.java
new file mode 100644
index 0000000000..bbfdf9183e
--- /dev/null
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug539367_ComboLongText2.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Simeon Andreev and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Simeon Andreev - initial API and implementation
+ *******************************************************************************/
+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.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+public class Bug539367_ComboLongText2 {
+
+ public static void main(String[] args) {
+ Display display = new Display();
+ Shell shell = new Shell(display);
+ shell.setSize(250, 150);
+ shell.setText("Bug combo text");
+ shell.setLayout(new FillLayout());
+
+ Composite parent = new Composite(shell, SWT.BORDER);
+ parent.setLayout(new GridLayout());
+
+ Combo combo = new Combo(shell, SWT.READ_ONLY | SWT.DROP_DOWN);
+ GridData comboGridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
+ combo.setLayoutData(comboGridData);
+ combo.add("some long long long long combo text");
+ combo.select(0);
+
+ Composite lastComposite = new Composite(shell, SWT.BORDER);
+ lastComposite.setLayout(new FillLayout());
+ Text text = new Text(lastComposite, SWT.NONE);
+ text.setText("my text");
+
+ shell.open();
+
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch())
+ display.sleep();
+ }
+ display.dispose();
+ }
+} \ No newline at end of file

Back to the top