Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEric Williams2018-08-14 17:29:36 +0000
committerEric Williams2018-08-14 17:33:43 +0000
commit929dab9ad8b639a3663e4e51a7b3d1b4ebc7642f (patch)
tree9c9107412841ce395d11c39b2ca5b0c5ae886c13 /tests
parentf0fe56670826e5b46e2c9a52c132ec39f531e136 (diff)
downloadeclipse.platform.swt-929dab9ad8b639a3663e4e51a7b3d1b4ebc7642f.tar.gz
eclipse.platform.swt-929dab9ad8b639a3663e4e51a7b3d1b4ebc7642f.tar.xz
eclipse.platform.swt-929dab9ad8b639a3663e4e51a7b3d1b4ebc7642f.zip
Bug 537713: [GTK3] Combo sizing problems
Do not perform resize calculations for Combos, as their large minimum and/or natural sizes causes API breakages with setBounds(). Tested with the snippets from this bug and bug 535323, AllNonBrowserTests, and the IDE: no allocation warnings occur. Change-Id: Ieefa0752fcb2dd3a743ebcc432eef939a46b73f4 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/Bug537713_ComboSizing.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug537713_ComboSizing.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug537713_ComboSizing.java
new file mode 100644
index 0000000000..dcf28eff3b
--- /dev/null
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug537713_ComboSizing.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Red Hat and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.tests.gtk.snippets;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+public class Bug537713_ComboSizing {
+
+ public static void main(String[] args) {
+ Display display = new Display();
+ Shell shell = new Shell(display);
+ Rectangle clientArea = shell.getClientArea();
+ Combo combo1 = new Combo(shell, SWT.BORDER);
+ combo1.setItems("Alpha", "Bravo", "Charlie");
+ Point prefSize = combo1.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ combo1.setBounds(clientArea.x, clientArea.y, prefSize.x, prefSize.y);
+ Combo combo2 = new Combo(shell, SWT.BORDER);
+ combo2.setItems("Alpha", "Bravo", "Charlie");
+ combo2.setBounds(clientArea.x, clientArea.y + prefSize.y, (prefSize.x / 2) - 20, prefSize.y);
+ Combo combo3 = new Combo(shell, SWT.BORDER);
+ combo3.setItems("Alpha", "Bravo", "Charlie");
+ combo3.setBounds(clientArea.x, clientArea.y + prefSize.y * 2, (prefSize.x / 2) + 1, prefSize.y);
+ shell.pack();
+ shell.open();
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch())
+ display.sleep();
+ }
+ display.dispose();
+ }
+
+} \ No newline at end of file

Back to the top