diff options
author | Simeon Andreev | 2018-02-19 16:17:30 +0000 |
---|---|---|
committer | Simeon Andreev | 2018-02-20 09:30:50 +0000 |
commit | 2feeddb0172f839c43ea8087619a9ea912eb88fa (patch) | |
tree | dfd78b912fdf1dff0f69754033902340ec6b4df9 /tests/org.eclipse.swt.tests | |
parent | 7b6eeb99d12f20e67e1d84a077c8f4a6977beecd (diff) | |
download | eclipse.platform.swt-2feeddb0172f839c43ea8087619a9ea912eb88fa.tar.gz eclipse.platform.swt-2feeddb0172f839c43ea8087619a9ea912eb88fa.tar.xz eclipse.platform.swt-2feeddb0172f839c43ea8087619a9ea912eb88fa.zip |
Bug 528498 - Combo menu is narrower than combo
In order to fix Bug 438992, wrap width of 1 was set for read-only
combos. This results in drop-down menus which are narrower than the
combo itself. Seen e.g. in the Eclipse Help preference page, where the
combos are as long as the page, but their entries are relatively short.
The drop-down menu is then only as short as the longest entry.
This change ensures that the GTK style option
-GtkComboBox-appears-as-list is used, for GTK versions above 3.22.5.
This changes the drop-down menu style, preventing both Bug 438992 and
Bug 528498.
The option cannot be used in earlier versions, since due to a bug, the
drop-down menu cannot be scrolled.
Change-Id: I96aecae46c6edef65e69a9ae590e713bf607dd4b
Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
Diffstat (limited to 'tests/org.eclipse.swt.tests')
-rw-r--r-- | tests/org.eclipse.swt.tests/ManualTests/org/eclipse/swt/tests/manual/Bug528498_Combo_dropDownMenu_is_too_short.java | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/tests/org.eclipse.swt.tests/ManualTests/org/eclipse/swt/tests/manual/Bug528498_Combo_dropDownMenu_is_too_short.java b/tests/org.eclipse.swt.tests/ManualTests/org/eclipse/swt/tests/manual/Bug528498_Combo_dropDownMenu_is_too_short.java new file mode 100644 index 0000000000..a0baae5d79 --- /dev/null +++ b/tests/org.eclipse.swt.tests/ManualTests/org/eclipse/swt/tests/manual/Bug528498_Combo_dropDownMenu_is_too_short.java @@ -0,0 +1,70 @@ +/******************************************************************************* + * Copyright (c) 2018 Simeon Andreev and others. All rights reserved. + * The contents of this file are made available under the terms + * of the GNU Lesser General Public License (LGPL) Version 2.1 that + * accompanies this distribution (lgpl-v21.txt). The LGPL is also + * available at http://www.gnu.org/licenses/lgpl.html. If the version + * of the LGPL at http://www.gnu.org is different to the version of + * the LGPL accompanying this distribution and there is any conflict + * between the two license versions, the terms of the LGPL accompanying + * this distribution shall govern. + * + * Contributors: + * Simeon Andreev - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.tests.manual; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; + + +/** + * Description: Combo box drop-down menu is narrower than combo itself, for read-only combos. + * Steps to reproduce: + * <ol> + * <li>click on main menu entry "Window"</li> + * <li>click on "Preferences"</li> + * <li>choose "Help"</li> + * <li>click on any combo in the preference page</li> + * </ol> + * Expected results: The drop down menu is as long as the combo. + * Actual results: The drop down menu is only as long as its longest entry. + */ +public class Bug528498_Combo_dropDownMenu_is_too_short { + + public static void main (String [] args) { + Display display = new Display (); + final Shell shell = new Shell (display); + shell.setSize(200, 50); + shell.setLayout(new FillLayout()); + shell.setLocation(center(display, shell)); + shell.setText("Bug 528498"); + + Combo c = new Combo(shell, SWT.READ_ONLY); + + for (int i = 0; i < 40; ++i) { + c.add("item " + i); + } + + shell.open (); + while (!shell.isDisposed ()) { + if (!display.readAndDispatch ()) display.sleep (); + } + display.dispose (); + } + + private static Point center(Display display, Shell shell) { + Rectangle displayBounds = display.getPrimaryMonitor().getBounds(); + Point shellBounds = shell.getSize(); + Point center = new Point( + displayBounds.x + (displayBounds.width - shellBounds.x) / 2, + displayBounds.y + (displayBounds.height - shellBounds.y) / 2); + + return center; + } +} |