mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ConsoleViewImplTest.testPerformance: dispatch events without reflection and unnecessary checks
This commit is contained in:
+1
-1
@@ -228,7 +228,7 @@ public class ConsoleViewImplTest extends LightPlatformTestCase {
|
||||
for (int i=0; i<10_000_000; i++) {
|
||||
console.print("xxx\n", ConsoleViewContentType.NORMAL_OUTPUT);
|
||||
console.print("yyy\n", ConsoleViewContentType.SYSTEM_OUTPUT);
|
||||
UIUtil.dispatchAllInvocationEvents();
|
||||
PlatformTestUtil.dispatchAllInvocationEventsInIdeEventQueue();
|
||||
}
|
||||
LightPlatformCodeInsightTestCase.type('\n', console.getEditor(), getProject());
|
||||
console.waitAllRequests();
|
||||
|
||||
@@ -304,8 +304,7 @@ public class PlatformTestUtil {
|
||||
|
||||
@TestOnly
|
||||
public static void dispatchAllInvocationEventsInIdeEventQueue() throws InterruptedException {
|
||||
assert SwingUtilities.isEventDispatchThread() : Thread.currentThread();
|
||||
final IdeEventQueue eventQueue = (IdeEventQueue)Toolkit.getDefaultToolkit().getSystemEventQueue();
|
||||
IdeEventQueue eventQueue = IdeEventQueue.getInstance();
|
||||
while (true) {
|
||||
AWTEvent event = eventQueue.peekEvent();
|
||||
if (event == null) break;
|
||||
@@ -318,8 +317,7 @@ public class PlatformTestUtil {
|
||||
|
||||
@TestOnly
|
||||
public static void dispatchAllEventsInIdeEventQueue() throws InterruptedException {
|
||||
assert SwingUtilities.isEventDispatchThread() : Thread.currentThread();
|
||||
final IdeEventQueue eventQueue = (IdeEventQueue)Toolkit.getDefaultToolkit().getSystemEventQueue();
|
||||
IdeEventQueue eventQueue = IdeEventQueue.getInstance();
|
||||
//noinspection StatementWithEmptyBody
|
||||
while (dispatchNextEventIfAny(eventQueue) != null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user