mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
sm test runner: print text with ANSI colors when reading file (IDEA-CR-32979)
This commit is contained in:
+14
-3
@@ -16,6 +16,7 @@
|
||||
package com.intellij.execution.testframework;
|
||||
|
||||
import com.intellij.execution.filters.HyperlinkInfo;
|
||||
import com.intellij.execution.process.ProcessOutputTypes;
|
||||
import com.intellij.execution.testframework.stacktrace.DiffHyperlink;
|
||||
import com.intellij.execution.testframework.ui.TestsOutputConsolePrinter;
|
||||
import com.intellij.execution.ui.ConsoleViewContentType;
|
||||
@@ -350,9 +351,7 @@ public class CompositePrintable extends UserDataHolderBase implements Printable,
|
||||
else {
|
||||
ConsoleViewContentType contentType = contentTypeByNameMap.getOrDefault(firstToken, ConsoleViewContentType.NORMAL_OUTPUT);
|
||||
String text = IOUtil.readString(reader);
|
||||
if (text != null) {
|
||||
printer.print(text, contentType);
|
||||
}
|
||||
printText(printer, text, contentType);
|
||||
}
|
||||
lineNum++;
|
||||
}
|
||||
@@ -374,6 +373,18 @@ public class CompositePrintable extends UserDataHolderBase implements Printable,
|
||||
}
|
||||
}
|
||||
|
||||
private void printText(Printer printer, String text, ConsoleViewContentType contentType) {
|
||||
if (ConsoleViewContentType.NORMAL_OUTPUT.equals(contentType)) {
|
||||
printer.printWithAnsiColoring(text, ProcessOutputTypes.STDOUT);
|
||||
}
|
||||
else if (ConsoleViewContentType.ERROR_OUTPUT.equals(contentType)) {
|
||||
printer.printWithAnsiColoring(text, ProcessOutputTypes.STDERR);
|
||||
}
|
||||
else {
|
||||
printer.print(text, contentType);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean wasPrintableChanged(Printer printer) {
|
||||
return printer instanceof TestsOutputConsolePrinter && !((TestsOutputConsolePrinter)printer).isCurrent(CompositePrintable.this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user