RFR: 8314906: [testbug] Create behavior tests for text input controls [v9]

Ajit Ghaisas aghaisas at openjdk.org
Fri Oct 6 05:29:13 UTC 2023


On Tue, 19 Sep 2023 21:53:16 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> Creating the first batch of tests and testing framework that enables writing behavior tests for javafx controls, focusing on key bindings.  The idea is to make writing such tests a simple process.  
>> 
>> This PR deals with the descendants of TextInputControl (TextField, PasswordField, TextArea).  Most of the tests are headless, but in some cases (TextArea) a headful test is required because the behavior needs rendered text to function (example: page up / page down / line start / line end and the like).
>> 
>> The tests exercise the key bindings registered by the Skin (or, rather the associated Behavior) at least once, and sometimes more than once.
>> 
>> Some mappings cannot be tested due to Robot not supporting keypad events (created [JDK-8316307](https://bugs.openjdk.org/browse/JDK-8316307)).
>> 
>> In addition, the key bindings are documented in /doc-files/behavior markdown documents:
>> 
>> https://github.com/andy-goryachev-oracle/jfx/blob/8314906.behavior.test/doc-files/behavior/PasswordField.md
>> https://github.com/andy-goryachev-oracle/jfx/blob/8314906.behavior.test/doc-files/behavior/TextArea.md
>> https://github.com/andy-goryachev-oracle/jfx/blob/8314906.behavior.test/doc-files/behavior/TextField.md
>> https://github.com/andy-goryachev-oracle/jfx/blob/8314906.behavior.test/doc-files/behavior/TextInputControl.md
>
> Andy Goryachev has updated the pull request incrementally with one additional commit since the last revision:
> 
>   allowed characters

modules/javafx.controls/src/test/java/test/com/sun/javafx/scene/control/infrastructure/KeyEventFirer.java line 49:

> 47:     private final EventTarget target;
> 48:     private final Scene scene;
> 49:     private static HashMap<Character,KeyCode> keyCodes;

minor : space after `,`

modules/javafx.controls/src/test/java/test/com/sun/javafx/scene/control/infrastructure/KeyEventFirer.java line 378:

> 376:     private static HashMap<Character, KeyCode> createKeyCodes(Object ... pairs) {
> 377:         HashMap<Character, KeyCode> m = new HashMap<>();
> 378:         for(int i=0; i<pairs.length; ) {

Minor : space before and after `=` and `<`

modules/javafx.controls/src/test/java/test/javafx/scene/control/behavior/BehaviorTestBase.java line 82:

> 80:      *     }
> 81:      * <pre>
> 82:      * @param control the control being tested

Remove `@param` line

modules/javafx.controls/src/test/java/test/javafx/scene/control/behavior/PasswordFieldBehaviorTest.java line 63:

> 61:     @Override
> 62:     public void testCopy() {
> 63:         // copy is disabled

An empty test case simply gets reported as passed.
Do you want to assert that the "copy is disabled" somehow?
There are a few other test cases in this file which are of similar nature.
If they need to be worked upon in future, we can mark them as TODO.
If they are just for information, we can keep the entire test cases commented so that they do not execute and report as passed.

modules/javafx.controls/src/test/java/test/javafx/scene/control/behavior/TextAreaBehaviorTest.java line 64:

> 62:     @Override
> 63:     public void testConsumeEnter() {
> 64:         // does not consume ENTER

Similar comment about empty test cases in this file.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1221#discussion_r1348247510
PR Review Comment: https://git.openjdk.org/jfx/pull/1221#discussion_r1348248822
PR Review Comment: https://git.openjdk.org/jfx/pull/1221#discussion_r1348251246
PR Review Comment: https://git.openjdk.org/jfx/pull/1221#discussion_r1348254369
PR Review Comment: https://git.openjdk.org/jfx/pull/1221#discussion_r1348257106


More information about the openjfx-dev mailing list