Lots of questions on here are asking about how to pause the JavaFX Application thread for a background thread, but I want the opposite!
I'm trying to test how long it takes for a series of key inputs to be fully handled. I am using the Automaton testing library for JavaFX, and editor.type(key) generates a keypress event that gets processed by the application. Here is one of many attempts:
long start = System.nanoTime();
editor.type(AGUtils.LEFT_ARROW);
editor.type(AGUtils.LEFT_ARROW);
editor.type(AGUtils.RIGHT_ARROW);
editor.type(AGUtils.RIGHT_ARROW);
FutureTask<Callable> t = new FutureTask<>(...);
Platform.runLater(t);
while (!t.isDone()) { } // wait for the FutureTask to be called
long end = System.nanoTime();
However, it seems the FX Application Thread might be handling the FutureTask before it handles the rest of the keypress events.
TLDR: I want to precisely measure when the JavaFX Application Thread has finished handling the four keypress events I generate.
How can I go about this? Thank you!