< prev index next >
functional/ControlsTests/test/javafx/scene/control/test/combobox/ComboBoxTest.java
Print this page
*** 31,40 ****
--- 31,41 ----
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,68 ****
--- 60,70 ----
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,97 ****
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
--- 88,97 ----
*** 161,177 ****
checkTextFieldText(Properties.armed, "false");
checkTextFieldText(Properties.showing, "true");
testedControl.mouse().press();
! checkTextFieldText(Properties.armed, "false");
checkTextFieldText(Properties.showing, "false");
testedControl.mouse().release();
checkTextFieldText(Properties.armed, "false");
checkTextFieldText(Properties.showing, "false");
}
@Smoke
@Test(timeout = 300000)//RT-18945
public void valuePropertyTest() throws InterruptedException {
--- 161,183 ----
checkTextFieldText(Properties.armed, "false");
checkTextFieldText(Properties.showing, "true");
testedControl.mouse().press();
! 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,227 ****
}
@ScreenshotCheck
@Test(timeout = 300000)//RT-19225
public void promptPropertyTest() throws Throwable {
! assertEquals((new ComboBox()).promptTextProperty().getValue(), "");
//move focus from control. otherwise, we will not see prompt.
requestFocusOnControl(testedControl);
testedControl.keyboard().pushKey(KeyboardButtons.TAB);
--- 223,233 ----
}
@ScreenshotCheck
@Test(timeout = 300000)//RT-19225
public void promptPropertyTest() throws Throwable {
! assertEquals((new ComboBox()).promptTextProperty().getValue(), null);
//move focus from control. otherwise, we will not see prompt.
requestFocusOnControl(testedControl);
testedControl.keyboard().pushKey(KeyboardButtons.TAB);
*** 333,343 ****
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");
setPropertyByToggleClick(SettingType.BIDIRECTIONAL, Properties.editable);
testedControl.as(Selectable.class).selector().select(element2);
checkSimpleListenerValue(Properties.selectedItem, element2);
}
--- 339,349 ----
String element3 = "Random element 3";
addElement(element3, 2);
testedControl.as(Selectable.class).selector().select(element3);
checkSimpleListenerValue(Properties.selectedItem, element3);
! assertEquals(getTextFieldText(), TO_STRING_PREFIX + "3");
setPropertyByToggleClick(SettingType.BIDIRECTIONAL, Properties.editable);
testedControl.as(Selectable.class).selector().select(element2);
checkSimpleListenerValue(Properties.selectedItem, element2);
}
*** 421,437 ****
testedControl.mouse().click();
testedControl.mouse().click();
testedControl.keyboard().pushKey(KeyboardButtons.A);
! checkCounterValue(ON_ACTION_EVENT_COUNTER_ID, 4);
testedControl.keyboard().pushKey(KeyboardButtons.ENTER);
! checkCounterValue(ON_ACTION_EVENT_COUNTER_ID, 5);
setPropertyByTextField(SettingType.BIDIRECTIONAL, Properties.value, NEW_VALUE_1);
! checkCounterValue(ON_ACTION_EVENT_COUNTER_ID, 7);
setPropertyByTextField(SettingType.UNIDIRECTIONAL, Properties.value, NEW_VALUE_2);
! checkCounterValue(ON_ACTION_EVENT_COUNTER_ID, 9);
}
@Smoke
@Test(timeout = 300000)//RT-19227
public void selectionTest() throws InterruptedException, Exception {
--- 427,443 ----
testedControl.mouse().click();
testedControl.mouse().click();
testedControl.keyboard().pushKey(KeyboardButtons.A);
! checkCounterValue(ON_ACTION_EVENT_COUNTER_ID, 3);
testedControl.keyboard().pushKey(KeyboardButtons.ENTER);
! checkCounterValue(ON_ACTION_EVENT_COUNTER_ID, 4);
setPropertyByTextField(SettingType.BIDIRECTIONAL, Properties.value, NEW_VALUE_1);
! checkCounterValue(ON_ACTION_EVENT_COUNTER_ID, 6);
setPropertyByTextField(SettingType.UNIDIRECTIONAL, Properties.value, NEW_VALUE_2);
! checkCounterValue(ON_ACTION_EVENT_COUNTER_ID, 8);
}
@Smoke
@Test(timeout = 300000)//RT-19227
public void selectionTest() throws InterruptedException, Exception {
*** 639,649 ****
//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);
sb.as(AbstractScroll.class).caret().to(1);
checkTextFieldText(Properties.showing, "true");
testedControl.as(Selectable.class).selector().select("6");
checkTextFieldText(Properties.showing, "false");
--- 645,657 ----
//scrollbar interaction test
addElements(1, 2, 3, 4, 5, 6);
setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.visibleRowCount, 5);
clickDropDownButton();
! 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,712 ****
testedControl.as(Selectable.class).selector().select("6");
checkSelectionState(5, 6);
assertEquals(getTextFieldText(), "6");
checkTextFieldText(Properties.value, "6");
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();
--- 705,720 ----
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.selectedItem, "6abc");
checkTextFieldText(Properties.value, "6abc");
clickDropDownButton();
*** 1271,1282 ****
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);
--- 1279,1288 ----
*** 1285,1294 ****
--- 1291,1302 ----
/* 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,1430 ****
final String testString = "test";
setPropertyByTextField(SettingType.SETTER, Properties.text, testString);
testedControl.keyboard().pushKey(KeyboardButtons.ENTER);
! checkTextFieldText(Properties.value, FROM_STRING_PREFIX + "1");
}
/**
* Tests format string converter and checks that transformation is performed
* properly
--- 1428,1438 ----
final String testString = "test";
setPropertyByTextField(SettingType.SETTER, Properties.text, testString);
testedControl.keyboard().pushKey(KeyboardButtons.ENTER);
! checkTextFieldText(Properties.value, FROM_STRING_PREFIX);
}
/**
* Tests format string converter and checks that transformation is performed
* properly
< prev index next >