changeset 5735:323f71bef4ae

RT-21186: ComboBox doesn't show tooltip over its TextField
author jgiles
date Tue, 12 Nov 2013 13:17:49 +1300
parents 9500977f0627
children f8e3cfc08d81
files modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java modules/controls/src/test/java/javafx/scene/control/ComboBoxTest.java
diffstat 2 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Mon Nov 18 11:24:01 2013 -0800
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Tue Nov 12 13:17:49 2013 +1300
@@ -397,6 +397,7 @@
         textField = comboBox.getEditor();
         textField.setFocusTraversable(true);
         textField.promptTextProperty().bind(comboBox.promptTextProperty());
+        textField.tooltipProperty().bind(comboBox.tooltipProperty());
 
         // Fix for RT-21406: ComboBox do not show initial text value
         initialTextFieldValue = textField.getText();
--- a/modules/controls/src/test/java/javafx/scene/control/ComboBoxTest.java	Mon Nov 18 11:24:01 2013 -0800
+++ b/modules/controls/src/test/java/javafx/scene/control/ComboBoxTest.java	Tue Nov 12 13:17:49 2013 +1300
@@ -1083,4 +1083,23 @@
             fail("Stack overflow should not happen here");
         }
     }
+
+    @Test public void test_rt21186() {
+        final ComboBox<String> comboBox = new ComboBox<>();
+        comboBox.setEditable(true);
+
+        new StageLoader(comboBox);
+
+        assertNull(comboBox.getTooltip());
+        assertNull(comboBox.getEditor().getTooltip());
+
+        Tooltip tooltip = new Tooltip("Tooltip");
+        comboBox.setTooltip(tooltip);
+        assertEquals(tooltip, comboBox.getTooltip());
+        assertEquals(tooltip, comboBox.getEditor().getTooltip());
+
+        comboBox.setTooltip(null);
+        assertNull(comboBox.getTooltip());
+        assertNull(comboBox.getEditor().getTooltip());
+    }
 }