46 import javafx.util.StringConverter;
47 import org.jemmy.Point;
48 import org.jemmy.action.GetAction;
49 import org.jemmy.control.Wrap;
50 import org.jemmy.fx.ByStyleClass;
51 import org.jemmy.fx.control.TextInputControlDock;
52 import org.jemmy.interfaces.Keyboard.KeyboardButton;
53 import org.jemmy.interfaces.Keyboard.KeyboardButtons;
54 import org.jemmy.interfaces.Keyboard.KeyboardModifiers;
55 import org.jemmy.interfaces.Modifier;
56 import org.jemmy.interfaces.Parent;
57 import org.jemmy.timing.State;
58 import static org.junit.Assert.*;
59 import org.junit.Test;
60 import org.junit.runner.RunWith;
61 import test.javaclient.shared.FilteredTestRunner;
62
63 /**
64 * @author Alexander Kirov, Dmitry Zinkevich
65 *
66 * @see <a href="http://xdesign.us.oracle.com/projects/javaFX/fxcontrols-ue/specifications/DatePicker/datepicker-UEspec.html">specification</a>
67 */
68 @RunWith(FilteredTestRunner.class)
69 public class DatePickerTest extends TestBase {
70 Double width;
71
72 void checkFinalState() {
73 checkTextFieldValue(Properties.width, width.doubleValue());
74 defaultController.check();
75 }
76
77 void rememberInitialState(Enum... excludePropertiesList) {
78 width = new GetAction<Double>() {
79 @Override
80 public void run(Object... parameters) throws Exception {
81 setResult(Double.valueOf(testedControl.getControl().getWidth()));
82 }
83 }.dispatch(testedControl.getEnvironment());
84
85 initChangingController(parent);
86 defaultController.include().allTables().allProperties().allCounters().apply();
268 waitShownText("12/31/1999");
269
270 setDate(LocalDate.of(2019, 12, 20));
271 clickDropDownButton();
272
273 description = new PopupSceneDescription();
274 description.extractData(); description.nextMonthDays.get(description.nextMonthDays.size() - 1).mouse().click();
275 expectedState.put("monthName", "January");
276 expectedState.put("year", "2020");
277 testedControl.waitState(new DateState(expectedState, description));
278
279 clickDropDownButton();
280 description.extractData(); description.currentMonthDays.get(26).mouse().click();
281 waitShownText("1/27/2020");
282 checkFinalState();
283 }
284
285 /**
286 * Checks that when navigating in horizontal or vertical direction
287 * the switching between days and months occurs correctly.
288 * @see <a href=http://xdesign.us.oracle.com/projects/javaFX/fxcontrols-ue/specifications/DatePicker/datepicker-UEspec.html#navigation>navigation</a>
289 *
290 * Also, tests for month/year navigation, respectively Control+PgUp/Control+PgDn and PgUp/PgDn
291 * @see <a href="https://javafx-jira.kenai.com/browse/RT-32493">RT-32493</a> and <a href="https://javafx-jira.kenai.com/browse/RT-32492">RT-32492</a>
292 */
293 @Test(timeout = 20000)
294 public void keyboardNavigation() throws InterruptedException {
295 rememberInitialState(Properties.showing, Properties.hover, Properties.pressed, Properties.armed);
296 setDate(LocalDate.of(2013, 01, 06));
297 clickDropDownButton();
298 waitPopupShowingState(true);
299
300 scene.keyboard().pushKey(KeyboardButtons.LEFT);
301 PopupSceneDescription description = new PopupSceneDescription();
302 description.extractData();
303
304 //Focus must be on 1/5/2013
305 description.currentMonthDays.get(4).waitProperty("isFocused", Boolean.TRUE);
306
307 for (int i = 0; i < 5; i++) scene.keyboard().pushKey(KeyboardButtons.LEFT);
308
|
46 import javafx.util.StringConverter;
47 import org.jemmy.Point;
48 import org.jemmy.action.GetAction;
49 import org.jemmy.control.Wrap;
50 import org.jemmy.fx.ByStyleClass;
51 import org.jemmy.fx.control.TextInputControlDock;
52 import org.jemmy.interfaces.Keyboard.KeyboardButton;
53 import org.jemmy.interfaces.Keyboard.KeyboardButtons;
54 import org.jemmy.interfaces.Keyboard.KeyboardModifiers;
55 import org.jemmy.interfaces.Modifier;
56 import org.jemmy.interfaces.Parent;
57 import org.jemmy.timing.State;
58 import static org.junit.Assert.*;
59 import org.junit.Test;
60 import org.junit.runner.RunWith;
61 import test.javaclient.shared.FilteredTestRunner;
62
63 /**
64 * @author Alexander Kirov, Dmitry Zinkevich
65 *
66 */
67 @RunWith(FilteredTestRunner.class)
68 public class DatePickerTest extends TestBase {
69 Double width;
70
71 void checkFinalState() {
72 checkTextFieldValue(Properties.width, width.doubleValue());
73 defaultController.check();
74 }
75
76 void rememberInitialState(Enum... excludePropertiesList) {
77 width = new GetAction<Double>() {
78 @Override
79 public void run(Object... parameters) throws Exception {
80 setResult(Double.valueOf(testedControl.getControl().getWidth()));
81 }
82 }.dispatch(testedControl.getEnvironment());
83
84 initChangingController(parent);
85 defaultController.include().allTables().allProperties().allCounters().apply();
267 waitShownText("12/31/1999");
268
269 setDate(LocalDate.of(2019, 12, 20));
270 clickDropDownButton();
271
272 description = new PopupSceneDescription();
273 description.extractData(); description.nextMonthDays.get(description.nextMonthDays.size() - 1).mouse().click();
274 expectedState.put("monthName", "January");
275 expectedState.put("year", "2020");
276 testedControl.waitState(new DateState(expectedState, description));
277
278 clickDropDownButton();
279 description.extractData(); description.currentMonthDays.get(26).mouse().click();
280 waitShownText("1/27/2020");
281 checkFinalState();
282 }
283
284 /**
285 * Checks that when navigating in horizontal or vertical direction
286 * the switching between days and months occurs correctly.
287 *
288 * Also, tests for month/year navigation, respectively Control+PgUp/Control+PgDn and PgUp/PgDn
289 * @see <a href="https://javafx-jira.kenai.com/browse/RT-32493">RT-32493</a> and <a href="https://javafx-jira.kenai.com/browse/RT-32492">RT-32492</a>
290 */
291 @Test(timeout = 20000)
292 public void keyboardNavigation() throws InterruptedException {
293 rememberInitialState(Properties.showing, Properties.hover, Properties.pressed, Properties.armed);
294 setDate(LocalDate.of(2013, 01, 06));
295 clickDropDownButton();
296 waitPopupShowingState(true);
297
298 scene.keyboard().pushKey(KeyboardButtons.LEFT);
299 PopupSceneDescription description = new PopupSceneDescription();
300 description.extractData();
301
302 //Focus must be on 1/5/2013
303 description.currentMonthDays.get(4).waitProperty("isFocused", Boolean.TRUE);
304
305 for (int i = 0; i < 5; i++) scene.keyboard().pushKey(KeyboardButtons.LEFT);
306
|