< prev index next >
functional/ControlsTests/test/javafx/scene/control/test/combobox/ComboBoxTest.java
Print this page
@@ -31,10 +31,11 @@
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.commons.SortValidator;
import javafx.event.Event;
import javafx.event.EventHandler;
@@ -59,10 +60,11 @@
import javafx.scene.shape.Polygon;
import javafx.scene.shape.Rectangle;
import javafx.util.Callback;
import javafx.util.StringConverter;
import javafx.util.converter.FormatStringConverter;
+import org.jemmy.Point;
import org.jemmy.action.GetAction;
import org.jemmy.control.Wrap;
import org.jemmy.fx.ByStyleClass;
import org.jemmy.fx.ByText;
import org.jemmy.fx.NodeWrap;
@@ -86,12 +88,10 @@
import test.javaclient.shared.FilteredTestRunner;
/**
* @author Alexander Kirov
*
- * Specification:
- * http://xdesign.us.oracle.com/projects/javaFX/fxcontrols-ue/specifications/combobox/combobox.html
*/
@RunWith(FilteredTestRunner.class)
public class ComboBoxTest extends TestBase {
@ScreenshotCheck
@@ -161,17 +161,23 @@
checkTextFieldText(Properties.armed, "false");
checkTextFieldText(Properties.showing, "true");
testedControl.mouse().press();
- checkTextFieldText(Properties.armed, "false");
+ checkTextFieldText(Properties.armed, "true");
checkTextFieldText(Properties.showing, "false");
testedControl.mouse().release();
checkTextFieldText(Properties.armed, "false");
checkTextFieldText(Properties.showing, "false");
+
+ testedControl.mouse().press();
+ org.jemmy.Rectangle bounds = testedControl.getScreenBounds();
+ testedControl.mouse().move(new Point(bounds.getWidth() + 5, testedControl.getScreenBounds().getHeight() + 5));
+
+ checkTextFieldText(Properties.armed, "false");
}
@Smoke
@Test(timeout = 300000)//RT-18945
public void valuePropertyTest() throws InterruptedException {
@@ -217,11 +223,11 @@
}
@ScreenshotCheck
@Test(timeout = 300000)//RT-19225
public void promptPropertyTest() throws Throwable {
- assertEquals((new ComboBox()).promptTextProperty().getValue(), "");
+ assertEquals((new ComboBox()).promptTextProperty().getValue(), null);
//move focus from control. otherwise, we will not see prompt.
requestFocusOnControl(testedControl);
testedControl.keyboard().pushKey(KeyboardButtons.TAB);
@@ -333,11 +339,11 @@
String element3 = "Random element 3";
addElement(element3, 2);
testedControl.as(Selectable.class).selector().select(element3);
checkSimpleListenerValue(Properties.selectedItem, element3);
- assertEquals(getTextFieldText(), TO_STRING_PREFIX + "1");
+ assertEquals(getTextFieldText(), TO_STRING_PREFIX + "3");
setPropertyByToggleClick(SettingType.BIDIRECTIONAL, Properties.editable);
testedControl.as(Selectable.class).selector().select(element2);
checkSimpleListenerValue(Properties.selectedItem, element2);
}
@@ -421,17 +427,17 @@
testedControl.mouse().click();
testedControl.mouse().click();
testedControl.keyboard().pushKey(KeyboardButtons.A);
- checkCounterValue(ON_ACTION_EVENT_COUNTER_ID, 4);
+ checkCounterValue(ON_ACTION_EVENT_COUNTER_ID, 3);
testedControl.keyboard().pushKey(KeyboardButtons.ENTER);
- checkCounterValue(ON_ACTION_EVENT_COUNTER_ID, 5);
+ checkCounterValue(ON_ACTION_EVENT_COUNTER_ID, 4);
setPropertyByTextField(SettingType.BIDIRECTIONAL, Properties.value, NEW_VALUE_1);
- checkCounterValue(ON_ACTION_EVENT_COUNTER_ID, 7);
+ checkCounterValue(ON_ACTION_EVENT_COUNTER_ID, 6);
setPropertyByTextField(SettingType.UNIDIRECTIONAL, Properties.value, NEW_VALUE_2);
- checkCounterValue(ON_ACTION_EVENT_COUNTER_ID, 9);
+ checkCounterValue(ON_ACTION_EVENT_COUNTER_ID, 8);
}
@Smoke
@Test(timeout = 300000)//RT-19227
public void selectionTest() throws InterruptedException, Exception {
@@ -639,11 +645,13 @@
//scrollbar interaction test
addElements(1, 2, 3, 4, 5, 6);
setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.visibleRowCount, 5);
clickDropDownButton();
- Wrap<? extends ScrollBar> sb = findScrollBar(((Wrap<? extends ListView>) getPopupWrap().as(Parent.class, Node.class).lookup(ListView.class).wrap()).as(Parent.class, Node.class), Orientation.VERTICAL, true);
+ Wrap<? extends ScrollBar> sb = findScrollBar(
+ ((Parent<Node>) ((Wrap<? extends ListView>) ((Parent<Node>) getPopupWrap().as(Parent.class, Node.class))
+ .lookup(ListView.class).wrap()).as(Parent.class, Node.class)), Orientation.VERTICAL, true);
sb.as(AbstractScroll.class).caret().to(1);
checkTextFieldText(Properties.showing, "true");
testedControl.as(Selectable.class).selector().select("6");
checkTextFieldText(Properties.showing, "false");
@@ -697,16 +705,16 @@
testedControl.as(Selectable.class).selector().select("6");
checkSelectionState(5, 6);
assertEquals(getTextFieldText(), "6");
checkTextFieldText(Properties.value, "6");
+ checkSimpleListenerValue(Properties.selectedIndex, 5);
testedControl.mouse().click();
testedControl.as(Text.class).type("abc");
testedControl.keyboard().pushKey(KeyboardButtons.ENTER);
- checkSimpleListenerValue(Properties.selectedIndex, 5);
checkSimpleListenerValue(Properties.selectedItem, "6abc");
checkTextFieldText(Properties.value, "6abc");
clickDropDownButton();
@@ -1271,12 +1279,10 @@
setPropertyByToggleClick(SettingType.UNIDIRECTIONAL, Properties.editable, false);
} else {
setPropertyByToggleClick(SettingType.UNIDIRECTIONAL, Properties.editable);
}
- Wrap<? extends javafx.scene.text.Text> textFieldWrap = testedControl.as(Parent.class, Node.class)
- .lookup(javafx.scene.text.Text.class).wrap();
final double initialButtonHeight = testedControl.getScreenBounds().getHeight();
double prevCellTextHeight = 0f;
for (int fontSize = INITIAL_FONT_SIZE; fontSize <= MAX_FONT_SIZE; fontSize += 2) {
String testVal = String.valueOf(fontSize);
@@ -1285,10 +1291,12 @@
/* check heighgt of the button */
assertEquals(initialButtonHeight, testedControl.getScreenBounds().getHeight(), 0.001);
/* text node should be alwas rendered inside ComboBox button */
+ Wrap<? extends javafx.scene.text.Text> textFieldWrap = testedControl.as(Parent.class, Node.class)
+ .lookup(javafx.scene.text.Text.class).wrap();
assertTrue(textFieldWrap.getScreenBounds().getY() >= testedControl.getScreenBounds().getY());
assertTrue(textFieldWrap.getScreenBounds().getY() + textFieldWrap.getScreenBounds().getHeight()
<= testedControl.getScreenBounds().getY() + testedControl.getScreenBounds().getHeight());
/* get wraps of cell and cell text node to compare coordinates */
@@ -1420,11 +1428,11 @@
final String testString = "test";
setPropertyByTextField(SettingType.SETTER, Properties.text, testString);
testedControl.keyboard().pushKey(KeyboardButtons.ENTER);
- checkTextFieldText(Properties.value, FROM_STRING_PREFIX + "1");
+ checkTextFieldText(Properties.value, FROM_STRING_PREFIX);
}
/**
* Tests format string converter and checks that transformation is performed
* properly
< prev index next >