testframework refactoring: test proxy schould forget about printer's marks

This commit is contained in:
anna
2010-07-23 12:37:55 +04:00
parent 6ec509cc1c
commit cee7bb5f3f
3 changed files with 18 additions and 20 deletions
@@ -141,4 +141,8 @@ public class TestsOutputConsolePrinter implements Printer, Disposable {
}
});
}
public boolean isMarked() {
return myMarkOffset > 0;
}
}
@@ -33,6 +33,7 @@ import com.intellij.execution.process.ProcessEvent;
import com.intellij.execution.process.ProcessHandler;
import com.intellij.execution.runners.ProgramRunner;
import com.intellij.execution.testframework.*;
import com.intellij.execution.testframework.ui.TestsOutputConsolePrinter;
import com.intellij.execution.ui.ConsoleViewContentType;
import com.intellij.execution.util.JavaParametersUtil;
import com.intellij.openapi.Disposable;
@@ -308,15 +309,21 @@ public abstract class TestObject implements JavaCommandLine {
final String text = event.getText();
final ConsoleViewContentType consoleViewType = ConsoleViewContentType.getConsoleViewType(outputType);
final TestProxy currentTest = packetsReceiver.getCurrentTest();
final TestsOutputConsolePrinter consolePrinter = consoleView.getPrinter();
final Printable printable = new Printable() {
public void printOn(final Printer printer) {
printer.print(text, consoleViewType);
}
};
if (currentTest != null) {
currentTest.onOutput(text, consoleViewType);
if (consoleViewType == ConsoleViewContentType.ERROR_OUTPUT && !consolePrinter.isMarked()) {
consolePrinter.mark();
}
currentTest.addLast(printable);
}
else {
consoleView.getPrinter().onNewAvailable(new Printable() {
public void printOn(final Printer printer) {
printer.print(text, consoleViewType);
}
});
consolePrinter.onNewAvailable(printable);
}
}
});
@@ -44,9 +44,8 @@ public class TestProxy extends AbstractTestProxy {
private TestEventsConsumer myEventsConsumer;
private int myPreviousMagnitude = -1;
private int myStateTimestamp = 0;
private boolean myMarked = false;
// private ArrayList myChildren = new ArrayList();
// private ArrayList myChildren = new ArrayList();
private final FilterCache myChildren = new FilterCache();
private TestProxy myParent = null;
public static final Filter NOT_LEAF = Filter.LEAF.not();
@@ -59,18 +58,6 @@ public class TestProxy extends AbstractTestProxy {
return getInfo().getComment() + "." + getInfo().getName();
}
public void onOutput(final String text, final ConsoleViewContentType contentType) {
if (!myMarked && contentType == ConsoleViewContentType.ERROR_OUTPUT) {
myPrinter.mark();
myMarked = true;
}
addLast(new Printable() {
public void printOn(final Printer printer) {
printer.print(text, contentType);
}
});
}
public void printOn(final Printer printer) {
super.printOn(printer);
CompositePrintable.printAllOn(myChildren.getList(), printer);