Many questions are asked here about how to suspend a JavaFX application thread for a background thread, but I want the opposite!
I am trying to check how long it takes to fully process a number of key inputs. I use the Automaton test library for JavaFX, and editor.type (key) generates a keystroke event that is handled 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()) { }
However, it seems that the FX application thread can handle FutureTask before it handles the rest of the keystroke events.
TL; DR: I want to accurately measure when the JavaFX Application Thread finished processing the four keypress events that I generate.
How can i do this? Thanks!
source share