mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
more stable replacement for waitForAlarm
This commit is contained in:
@@ -280,6 +280,20 @@ public class PlatformTestUtil {
|
||||
}
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public static void waitFor(long duration, @NotNull TimeUnit unit) {
|
||||
waitFor(unit.toMillis(duration));
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public static void waitFor(long millis) {
|
||||
assert millis > 0 && EventQueue.isDispatchThread();
|
||||
long startTimeMillis = System.currentTimeMillis();
|
||||
while (millis > (System.currentTimeMillis() - startTimeMillis)) {
|
||||
UIUtil.dispatchAllInvocationEvents();
|
||||
}
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public static void waitForCallback(@NotNull ActionCallback callback) {
|
||||
AsyncPromise<?> promise = new AsyncPromise<>();
|
||||
|
||||
Reference in New Issue
Block a user