New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(refactor) Replace calls to FXRobot with Event.fireEvent. #355
Conversation
It is really quite interesting. There are currently two failing tests:
For some reason the text area text contains everything but the first line (and apparently the first tab character). I am really not sure what would cause this. I tried replacing the Guava |
Review notes. Need to check:
|
If the tabs are removed from the text like so: String text = "All in the golden afternoon\n" +
"Full leisurely we glide;\n" +
"For both our oars, with little skill,\n" +
"By little arms are plied;\n" +
"While little hands make vain pretence\n" +
"Our wanderings to guide."; then the text-area contains no text at all. If a tab character is added at the beginning (so that the tab character is the first character of the text) like so: String text = "\tAll in the golden afternoon\n" +
"\tFull leisurely we glide;\n" +
"For both our oars, with little skill,\n" +
"\tBy little arms are plied;\n" +
"While little hands make vain pretence\n" +
"\tOur wanderings to guide."; then all the text is there except the initial tab character. If a tab character is pressed, typed, and released first: private void typeText(String text) {
keyPressTypeRelease(KeyCode.TAB, String.valueOf('\t'));
for (char character : Lists.charactersOf(text)) {
KeyCode key = KeyCode.UNDEFINED;
key = (character == '\n') ? KeyCode.ENTER : key;
key = (character == '\t') ? KeyCode.TAB : key;
keyPressTypeRelease(key, String.valueOf(character));
}
robotAdapter.timerWaitForIdle();
} then the assertions pass and no tests fail. I am very confused. Is it possible that maybe the text-area is not focused and tabbing switches focus to it? Edit: It would seem that my supposition was indeed correct...the |
07ed404
to
0c23472
Compare
There is a system property that FXRobot uses to set that it should print debugging hints, PlatformImpl.runLater(() -> {
out("doKeyEvent: injecting: {e}");
FXRobotHelper.sceneAccessor.processKeyEvent(target, e);
}); This just prints: [FXRobot] doKeyEvent: injecting: {e} Maybe template Strings like that were a planned feature? Who knows. Anyways, at least we can see the mouse events. I added some debugging statements to the new code that mimic the ones from Old code:
New code:
I forgot to add However what is different is that after the mouse events are run, the old code has the |
625239f
to
07a3492
Compare
The Java 9 build is allowed to fail for now. It should be able to possibly work once gradle/gradle#890 is fixed.
I still am puzzled by this one difference...but I think it's safe to merge this because the input/outputs are identical...and I don't want to hold up Java 9 support any longer. If this becomes a nightmare of people getting failed tests, I will revert the respective changes. |
Ref #228