Merge remote-tracking branch 'origin/master'

This commit is contained in:
Vladislav.Soroka
2015-11-27 08:58:31 +03:00
6 changed files with 30 additions and 3 deletions
@@ -92,7 +92,7 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
@NonNls private static final String CONSOLE_VIEW_POPUP_MENU = "ConsoleView.PopupMenu";
private static final Logger LOG = Logger.getInstance("#com.intellij.execution.impl.ConsoleViewImpl");
private static final int DEFAULT_FLUSH_DELAY = SystemProperties.getIntProperty("console.flush.delay.ms", 200);
static final int DEFAULT_FLUSH_DELAY = SystemProperties.getIntProperty("console.flush.delay.ms", 200);
private static final CharMatcher NEW_LINE_MATCHER = CharMatcher.anyOf("\n\r");
@@ -28,7 +28,6 @@ import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.testFramework.LightPlatformTestCase;
import com.intellij.testFramework.TestDataProvider;
import com.intellij.util.Alarm;
import com.intellij.util.SystemProperties;
import com.intellij.util.TimeoutUtil;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
@@ -78,12 +77,40 @@ public class ConsoleViewImplTest extends LightPlatformTestCase {
}, 0);
latch.await();
UIUtil.dispatchAllInvocationEvents();
TimeoutUtil.sleep(SystemProperties.getIntProperty("console.flush.delay.ms", 200));
TimeoutUtil.sleep(ConsoleViewImpl.DEFAULT_FLUSH_DELAY);
UIUtil.dispatchAllInvocationEvents();
assertFalse(console.hasDeferredOutput());
assertEquals("Test", console.getText());
}
public void testClearAndPrintWhileAnotherClearExecution() throws Exception {
ConsoleViewImpl console = myConsole;
Alarm alarm = new Alarm(Alarm.ThreadToUse.SHARED_THREAD);
for (int i = 0; i < 100; i++) {
// To speed up test execution, set -Dconsole.flush.delay.ms=5 to reduce ConsoleViewImpl.DEFAULT_FLUSH_DELAY
System.out.println("Attempt #" + i);
console.clear(); // 1-st clear
CountDownLatch latch = new CountDownLatch(1);
alarm.addRequest(() -> {
console.clear(); // 2-nd clear
console.print("Test", ConsoleViewContentType.NORMAL_OUTPUT);
latch.countDown();
}, 0);
UIUtil.dispatchAllInvocationEvents(); // flush 1-st clear request
latch.await();
UIUtil.dispatchAllInvocationEvents(); // flush 2-nd clear request
TimeoutUtil.sleep(ConsoleViewImpl.DEFAULT_FLUSH_DELAY);
UIUtil.dispatchAllInvocationEvents(); // flush print request
// Need more investigation: sometimes console.hasDeferredOutput() is true
while (console.hasDeferredOutput()) {
TimeoutUtil.sleep(10);
UIUtil.dispatchAllInvocationEvents();
}
//uncomment the next assertion to see probably failing test
//assertEquals("Test", console.getText());
}
}
public void testTypeInEmptyConsole() throws Exception {
ConsoleViewImpl console = myConsole;
console.clear();
Binary file not shown.

Before

Width:  |  Height:  |  Size: 331 B

After

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 903 B

After

Width:  |  Height:  |  Size: 918 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 912 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B