@@ -262,18 +262,18 @@ public void start(Stage stage) throws Exception {
262262 );
263263 }
264264
265- @ Before
266- public void setup () throws TimeoutException {
267- // When the stage's width changes, TextFlow does not properly handle API calls to a
268- // multi-line paragraph immediately. So, wait until it correctly responds
269- // to the stage width change
270- WaitForAsyncUtils .waitFor (5 , TimeUnit .SECONDS ,
271- () -> area .getParagraphLinesCount (0 ) == lines .length
272- );
273- }
274-
275265 public class NoModifiers {
276266
267+ @ Before
268+ public void setup () throws TimeoutException {
269+ // When the stage's width changes, TextFlow does not properly handle API calls to a
270+ // multi-line paragraph immediately. So, wait until it correctly responds
271+ // to the stage width change
272+ WaitForAsyncUtils .waitFor (5 , TimeUnit .SECONDS ,
273+ () -> area .getParagraphLinesCount (0 ) == lines .length
274+ );
275+ }
276+
277277 @ Test
278278 public void up () {
279279 moveCaretTo (lineStart (2 ));
@@ -323,7 +323,14 @@ public void end() {
323323 public class ShortcutDown {
324324
325325 @ Before
326- public void setup () {
326+ public void setup () throws TimeoutException {
327+ // When the stage's width changes, TextFlow does not properly handle API calls to a
328+ // multi-line paragraph immediately. So, wait until it correctly responds
329+ // to the stage width change
330+ WaitForAsyncUtils .waitFor (5 , TimeUnit .SECONDS ,
331+ () -> area .getParagraphLinesCount (0 ) == lines .length
332+ );
333+
327334 press (SHORTCUT );
328335 }
329336
@@ -377,7 +384,14 @@ public void end() {
377384 public class ShiftDown {
378385
379386 @ Before
380- public void setup () {
387+ public void setup () throws TimeoutException {
388+ // When the stage's width changes, TextFlow does not properly handle API calls to a
389+ // multi-line paragraph immediately. So, wait until it correctly responds
390+ // to the stage width change
391+ WaitForAsyncUtils .waitFor (5 , TimeUnit .SECONDS ,
392+ () -> area .getParagraphLinesCount (0 ) == lines .length
393+ );
394+
381395 press (SHIFT );
382396 }
383397
@@ -430,7 +444,14 @@ public void end() {
430444 public class ShortcutShiftDown {
431445
432446 @ Before
433- public void setup () {
447+ public void setup () throws TimeoutException {
448+ // When the stage's width changes, TextFlow does not properly handle API calls to a
449+ // multi-line paragraph immediately. So, wait until it correctly responds
450+ // to the stage width change
451+ WaitForAsyncUtils .waitFor (5 , TimeUnit .SECONDS ,
452+ () -> area .getParagraphLinesCount (0 ) == lines .length
453+ );
454+
434455 press (SHORTCUT , SHIFT );
435456 }
436457
0 commit comments