Django template debugger test.
authorDmitry Trofimov <dmitry.trofimov@jetbrains.com>
Fri, 29 Apr 2011 14:51:16 +0000 (18:51 +0400)
committerDmitry Trofimov <dmitry.trofimov@jetbrains.com>
Fri, 29 Apr 2011 15:18:54 +0000 (19:18 +0400)
platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XDebuggerTestUtil.java

index d72f960e41cee81e60545e48404c309f8c666e26..8a126bbf93a789d2bf701f06dfc054714f39ebd0 100644 (file)
  */
 package com.intellij.xdebugger;
 
+import com.intellij.execution.impl.ConsoleViewImpl;
 import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.application.Result;
+import com.intellij.openapi.application.WriteAction;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.vfs.VirtualFile;
@@ -125,7 +128,7 @@ public class XDebuggerTestUtil {
     throw new AssertionError("var '" + name + "' not found");
   }
 
-  public static XTestValueNode computePresentation(XValue value) throws InterruptedException {
+  public static XTestValueNode computePresentation(@NotNull XValue value) throws InterruptedException {
     XTestValueNode node = new XTestValueNode();
     if (value instanceof XNamedValue) {
       node.myName = ((XNamedValue)value).getName();
@@ -201,6 +204,17 @@ public class XDebuggerTestUtil {
     assertVariable(findVar(vars, name), name, type, value, hasChildren);
   }
 
+  @NotNull
+  public static String getConsoleText(final @NotNull ConsoleViewImpl consoleView) {
+    new WriteAction() {
+      protected void run(Result result) throws Throwable {
+        consoleView.flushDeferredText();
+      }
+    }.execute();
+
+    return consoleView.getEditor().getDocument().getText();
+  }
+
   public static class XTestStackFrameContainer extends XTestContainer<XStackFrame> implements XExecutionStack.XStackFrameContainer {
     public void addStackFrames(@NotNull List<? extends XStackFrame> stackFrames, boolean last) {
       addChildren(stackFrames, last);