do not preload anything in tests
authorGregory.Shrago <gregory.shrago@jetbrains.com>
Sat, 21 May 2022 23:42:06 +0000 (02:42 +0300)
committerintellij-monorepo-bot <intellij-monorepo-bot-no-reply@jetbrains.com>
Sat, 21 May 2022 23:59:41 +0000 (23:59 +0000)
GitOrigin-RevId: 976f59934a49836cacad182dbdddf3d7715ba5a6

platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/PopupMenuPreloader.java

index af3676b4ba6ee2aac694290b155a4943da70d28a..18c21d50307be033fb9f943074ff30679bf2ab84 100644 (file)
@@ -7,6 +7,7 @@ import com.intellij.openapi.actionSystem.ActionGroup;
 import com.intellij.openapi.actionSystem.ActionPlaces;
 import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.actionSystem.DataContext;
+import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.ex.util.EditorUtil;
 import com.intellij.openapi.editor.impl.EditorComponentImpl;
@@ -49,6 +50,7 @@ public final class PopupMenuPreloader implements Runnable, HierarchyListener {
                              @NotNull String actionPlace,
                              @Nullable PopupHandler popupHandler,
                              @NotNull Supplier<? extends ActionGroup> groupSupplier) {
+    if (ApplicationManager.getApplication().isUnitTestMode()) return;
     if (component instanceof EditorComponentImpl && ourEditorContextMenuPreloadCount > 4 ||
         component instanceof IdeMenuBar && SwingUtilities.getWindowAncestor(component) instanceof IdeFrame.Child) {
       return;