From beba0c0697ef5bee98dce547ce64a5c9a0730506 Mon Sep 17 00:00:00 2001 From: Sergey Karashevich Date: Tue, 26 Jul 2016 19:08:00 +0300 Subject: [PATCH] gui-tests-framework: we are muting TestRunnerUtil.replaceIdeEventQueueSafely() for _FirstInSuiteTest.testNothing() because it raises problem with RepaintManager and EventQueue, and as a result we have JFrames with unrendered content. Adding system property idea.test.guiTestMode=true --- .../src/com/intellij/tests/gui/framework/GuiTestCase.java | 5 +++-- platform/testFramework/src/_FirstInSuiteTest.java | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/community-tests/src/com/intellij/tests/gui/framework/GuiTestCase.java b/community-tests/src/com/intellij/tests/gui/framework/GuiTestCase.java index 3591008b4f23..21751ccea33f 100644 --- a/community-tests/src/com/intellij/tests/gui/framework/GuiTestCase.java +++ b/community-tests/src/com/intellij/tests/gui/framework/GuiTestCase.java @@ -68,6 +68,7 @@ import static junit.framework.Assert.assertNotNull; import static org.fest.swing.edt.GuiActionRunner.execute; import static org.fest.swing.timing.Pause.pause; import static org.fest.util.Strings.quote; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -91,10 +92,10 @@ public abstract class GuiTestCase { @Before public void setUp() throws Exception { if (!canRunGuiTests()) { - // We currently do not support running UI tests in headless environments. return; } - System.setProperty("GuiTestMode", "true"); + + assertEquals(System.getProperty("idea.test.guiTestMode"), "true"); Application application = ApplicationManager.getApplication(); assertNotNull(application); // verify that we are using the IDE's ClassLoader. diff --git a/platform/testFramework/src/_FirstInSuiteTest.java b/platform/testFramework/src/_FirstInSuiteTest.java index 671659a77c8b..139606763d8c 100644 --- a/platform/testFramework/src/_FirstInSuiteTest.java +++ b/platform/testFramework/src/_FirstInSuiteTest.java @@ -64,7 +64,11 @@ public class _FirstInSuiteTest extends TestCase { // in tests EDT inexplicably shuts down sometimes during the first access, // which leads to nasty problems in ApplicationImpl which assumes there is only one EDT. // so we try to forcibly terminate EDT here to urge JVM to re-spawn new shiny permanent EDT-1 - TestRunnerUtil.replaceIdeEventQueueSafely(); + + //replacing of IdeEventQueue may cause problems with RepaintManager and EventQueue especially on Windows for GUI tests + if (!System.getProperty("idea.test.guiTestMode").toLowerCase().equals("true")) { + TestRunnerUtil.replaceIdeEventQueueSafely(); + } SwingUtilities.invokeAndWait(() -> System.out.println("EDT is " + Thread.currentThread())); // force platform JNA load