updates the gui tests

This commit is contained in:
hneemann 2021-03-24 14:22:08 +01:00
parent 8835ddf4d2
commit aa8c3d8a7d
2 changed files with 9 additions and 3 deletions

View File

@ -483,10 +483,16 @@ public class GuiTester {
}
public final static class WaitFor implements Runnable {
private Condition cond;
private final int loops;
private final Condition cond;
public WaitFor(Condition cond) {
this(2000, cond);
}
public WaitFor(int timeinMs, Condition cond) {
this.cond = cond;
this.loops = timeinMs / 100;
}
@Override
@ -494,7 +500,7 @@ public class GuiTester {
int n = 0;
while (!cond.proceed()) {
Thread.sleep(100);
if (n++ > 20)
if (n++ > loops)
throw new RuntimeException("time out!");
}
}

View File

@ -464,7 +464,7 @@ public class TestInGUI extends TestCase {
.typeTempFile("test")
.press("ENTER")
.delay(600)
.add(new GuiTester.WaitFor(() -> {
.add(new GuiTester.WaitFor(4000, () -> {
Window activeWindow = FocusManager.getCurrentManager().getActiveWindow();
return !(activeWindow instanceof Main || activeWindow instanceof TableDialog);
}))